Interactive Shell & unicode

Timo Lindemann <>
Thu Sep 23 12:18:15 CEST 2010


Hi, 

it seems that the erlang shell is somehow affecting Unicode output in
the following situation:

-module(test).
-compile(export_all).

start() -> 
    ets:new(tbl, [named_table, set]),
    ets:insert(tbl, {1, "ä"}),
    io:format("~p~n", ets:tab2list(tbl)). 

(I don't know if that only happens with ets or dets tables, however.)

If I do 
> erl -run test -run init stop 
then the output is garbled:
> {1,"ä"}

but if I disable the shell, the output is correct:
> erl -run test -run init stop -noshell
> {1,"ä"}

This is Erlang 64-bit on Linux, btw. On my colleague's Powerbook G4,
both commands produce the output 
> {1,[195,131,194,164]}

What am I doing wrong? Not that it overly impedes my work, but I spent
hours, yesterday, in trying to produce right string output that
apparently looked correct to everyone else. Any ideas?

Greetings, 
-T. 



More information about the erlang-questions mailing list