Bug? -noinput breaks unicode output

With Erlang 25, on macOS and Linux (WSL), the -noshell and -noinput options break Unicode output.

Without -noinput or -noshell, the output is correct:

% erl -eval 'io:put_chars(user, [<<10007/utf8>>, " HEAVY BALLOT X", "\n"]), halt().'
Erlang/OTP 25 [erts-13.1.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]

✗ HEAVY BALLOT X

With either option, the output is broken:

% erl -noshell -eval 'io:put_chars(user, [<<10007/utf8>>, " HEAVY BALLOT X", "\n"]), halt().'
\x{2717} HEAVY BALLOT X
% erl -noinput -eval 'io:put_chars(user, [<<10007/utf8>>, " HEAVY BALLOT X", "\n"]), halt().'
\x{2717} HEAVY BALLOT X

How do I get proper Unicode output and -noshell?

try this;

erl -noinput -eval 'io:setopts(standard_io, [{encoding, unicode}]), io:put_chars(user, [<<10007/utf8>>, " HEAVY BALLOT X", "\n"]), halt().'

1 Like