[erlang-questions] 回复： ejabberd translate crash
Mon Apr 14 15:13:33 CEST 2014
I’m not really familiar with ejabberd in particular, but I can think of two possible ways to fix your problem:
change the iolist_to_binary call to uncidoe:characters_to_binary, which will take care of utf8 encoding the unicode code points
change the translation file (el.msg) to contain the translations as binaries instead of strings (<<“…”/utf8>>)
I’d prefer the first solution, btw.
On 2014 Apr 11, at 8:41 , nickel chen <> wrote:
> anyone information, please? i'm stucked at this problem.
> nickel chen <> 于 2014年4月10日, 星期四, 3:24 下午 写道：
> Hi all, I'm new to erlang and I'm learning the code of ejabberd 13.12, I already have ejabberd installed, then start it with
> sudo ejabberdctl start
> There is a crash message in /var/log/ejabberd.log
> 2014-04-10 14:37:56.520 [info] <0.7.0> Application ejabberd exited with reason: bad argument in call to erlang:iolist_to_binary([916,953,945,956,972,961,966,969,963,951,32,928,961,972,963,946,945,963,951,962]) in translate:'-load_file/2-fun-2-'/3 line 91
> i added some debug info to the source code ` translate.erl` and recompile ejabberd. then start it again, below is the debug message:
> 2014-04-10 14:37:56.517 [info] <0.38.0>@translate:load_file:87 File is: <<"//lib/ejabberd/priv/msgs/el.msg">>, Orig is:"Access Configuration", Trans is: [916,953,945,956,972,961,966,969,963,951,32,928,961,972,963,946,945,963,951,962]
> well it's clear that there are unicode characters in I18N translation , when passed to the erlang:iolist_to_binary/1, it crashed with badarg, because iolist only accepts byte( ) binary( ) and other iolist( )
> 9> erlang:iolist_to_binary().
> ** exception error: bad argument
> in function iolist_to_binary/1
> called as iolist_to_binary()
> 10> erlang:iolist_to_binary().
> My question is simple, how to get around with this problem and get ejabberd launched?
> Thanks in advance!
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions