[erlang-bugs] Unicode bug in io:format

eurekafag <>
Tue Nov 22 13:11:58 CET 2011


Many thanks for this thorough research! However I have two things to
mention. Setting or getting encoding introduces noticeable delay in
launching without -noinput, but with it it starts just as fast as usual.
Pretty strange. And another a bit illogical issue: to print UTF-8 strings
one should NOT set binary type /utf8. This works fine with encoding
set: io:format("~ts~n", [<<"Тестовая строка">>]).
This fails in both noinput-cases with encoding set: io:format("~ts~n",
[<<"Тестовая строка"/utf8>>]).

I guess it's because of double encoding (by explicitly defined encoding and
that suffix) but I was confused at first. It's better not to set encoding
but declare it in binary strings like they do in Python prepending strings
with 'u' literal, which doesn't work in Erlang for all cases.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20111122/5f3196fa/attachment.html>


More information about the erlang-bugs mailing list