[erlang-bugs] standard_error IO device is not being set to unicode

José Valim jose.valim@REDACTED
Thu Apr 10 19:54:22 CEST 2014


Hello OTP Team,

I am using Erlang 17.0 and it seems the standard_error device is not being
set to unicode. On a Mac OS X:

1> io:format("~p~n", ["josé"]).
"josé"
ok
2> io:format(standard_error, "~p~n", ["josé"]).
"jos�"
ok

If we inspect the standard_error process, we can see in the process
dictionary that unicode is set to false:

3> process_info(whereis(standard_error), dictionary).
{dictionary,[{unicode,false}]}

Once I explicitly enable unicode, it works:

4> io:setopts(standard_error, [{unicode, true}]).
ok
5> io:format(standard_error, "~p~n", ["josé"]).
"josé"
ok

Thank you!

PS: I found it interesting that the standard_error process does not accept
the same options as the standard_io one:

6> io:setopts(standard_error, [{encoding, utf8}]).
{error,enotsup}
7> io:setopts(standard_error, [{unicode, true}]).
ok
8> io:setopts(standard_io, [{unicode, true}]).
{error,enotsup}
9> io:setopts(standard_io, [{encoding, utf8}]).
ok

However this seems to be an "old" behaviour (it exists at least in R16 too).

*José Valim*
www.plataformatec.com.br
Skype: jv.ptec
Founder and Lead Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-bugs/attachments/20140410/b4cce6e2/attachment.htm>


More information about the erlang-bugs mailing list