[erlang-questions] 回复: ejabberd translate crash

Dániel Szoboszlay dszoboszlay@REDACTED
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 <nickelchen@REDACTED> wrote:

> anyone information,  please? i'm stucked at this problem.
> nickel chen <nickelchen@REDACTED> 于 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([256]).
> ** exception error: bad argument
>      in function  iolist_to_binary/1
>         called as iolist_to_binary([256])
> 10> erlang:iolist_to_binary([255]).
> <<"ÿ">>
> 11> 
> My question is simple, how to get around with this problem and get ejabberd launched?
> Thanks in advance!
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140414/0bd5a9e6/attachment.htm>

More information about the erlang-questions mailing list