[erlang-questions] io format and utf8?
Davide Marquês
nesrait@REDACTED
Wed May 20 04:10:53 CEST 2009
Hi Kunthar,
Comments below. :)
4> "ğüö".
[287,252,246]
5> "süö".
"süö"
6> list_to_binary("süö").
<<"süö">>
7> list_to_binary("ğüö").
** exception error: bad argument
in function list_to_binary/1
called as list_to_binary([287,252,246])
8> io:format("|~10.3.+ts|~n",["ğüö"]).
|+++++++ğüö|
The ğ character isn't valid latin1 (which is what normally erlang is
expecting).
When calling io:format/2 with non-latin1 strings you have to use ~ts instead
of ~s.
More details:
http://www.erlang.org/doc/man/unicode.html
http://erlang.org/eeps/eep-0010.html
By the way, you need OTP >= R13A to get that to work.
Cheers,
:Davide
2009/5/19 Kunthar <kunthar@REDACTED>
> (tester2@REDACTED)19> io:format("|~10.3.+s|~n",["süö"]).
> |+++++++süö|
> ok
>
> (tester2@REDACTED)20> io:format("|~10.3.+s|~n",["ğüö"]).
> ** exception exit: {badarg,[{io,format,
> [<0.31.0>,"|~10.3.+s|~n",[[287,252,246]]]},
> {erl_eval,do_apply,5},
> {shell,exprs,6},
> {shell,eval_exprs,6},
> {shell,eval_loop,3}]}
> in function io:o_request/3
>
>
> Comments?
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090520/147960f4/attachment.htm>
More information about the erlang-questions
mailing list