[erlang-questions] io:format error with UTF-8 encoding binary

Caoyuan dcaoyuan@REDACTED
Wed May 16 10:35:09 CEST 2007


Did somebody else encounter error when io:format(~p~n, [Bin]) where
Bin is a binary with UTF-8 encoding string?

I encountered this error several times, to reproduce it, please try
attached text file:
> erl
1> {ok, Bin} = file:read_file("6.txt").
2> io:format("Content: ~p~n", [Bin]).

Then erl shell will hang, without any error message printed out. And
also, the Bin could not be inserted into MYSQL blob field too.

The lasted three bytes of 6.txt is <<226,128,156>>. If I remove these
3 bytes, everything works fine.

My environment is Windows XP. the OTP is otp_win32_R11B-4

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 6.txt
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070516/420b1759/attachment.txt>

More information about the erlang-questions mailing list