[erlang-questions] Unicode problems

eurekafag eurekafag@REDACTED
Tue Nov 15 19:57:45 CET 2011

I'm trying to implement encoding detection and reencoding to utf-8
using erlang-iconv. Now I'm stuck with insane strings handling which
depends on -noinput parameter. Maybe it's a bug or I don't know
something. The code:


main() ->
    io:format("~ts~n", ["Тестовая строка"]).

These lines should be the same but they don't. If I run this module like this:
erlc test2.erl; erl -run test2 main
I get:

Erlang R14B04 (erts-5.8.5) [source] [64-bit] [smp:8:8] [rq:8]
[async-threads:0] [kernel-poll:false]

Тестовая строка
Eshell V5.8.5  (abort with ^G)
So the first line is displayed correctly but the second isn't. Then I
run the same compiled module like this:
erl -run test2 main -noinput
And suddenly it prints:
Тестовая строка
Now the second line worked as expected and the first failed. How
should I print unicode strings so they would look correctly with and
withount -noinput? What's the most correct way?

More information about the erlang-questions mailing list