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

Caoyuan <>
Wed May 16 17:38:38 CEST 2007


Hi Adam,

I tried the Regional and Languages settings, the issue is still there.
The problem is a bit strange, sometimes, if I cut the length to a bit
small value, it works fine (A longer binary without UTF-8 encoded
3-bytes chars always works fine).

Since there is no error messages outputted, I have no way to trace it.
In case of my application that uses MYSQL, the erlang node will die
when I insert such binary to BLOB field.

If this happens only on my environment, it may be os/platform related
bug of OTP?

Regards,

On 5/16/07, Adam Lindberg <> wrote:
> Hi Caoyuan!
>
> You could try to change the language and see if that's it. Try going
> to the Control Panel and start Regional and Language settings and
> change it, see if that helps. You could also try to temporarily change
> keyboard layout (seems to me that some stuff in Windows is connected
> to that too).
>
> Cheers!
> Adam
>
> On 5/16/07, Caoyuan <> wrote:
> > I'm just wondering if it depends on OS and OS's default Language
> > setting, my language setting is zh_CN. I tried again and again on my
> > machine, it hangs every time :-)
> >
> > On 5/16/07, Vlad Dumitrescu <> wrote:
> > > Hi,
> > >
> > > It works for me just fine on Windows.
> > >
> > > regards,
> > > Vlad
> > >
> > > On 5/16/07, Caoyuan <> wrote:
> > > > Hi,
> > > >
> > > > 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
> > > >
> > > > Thanks.
> > > >
> > > > _______________________________________________
> > > > erlang-questions mailing list
> > > > 
> > > > http://www.erlang.org/mailman/listinfo/erlang-questions
> > > >
> > > >
> > > >
> > >
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> --
> Adam Lindberg
> Software Developer
>
> Erlang Training and Consulting Ltd
> 401 Fruit and Wool Exchange,
> Brushfield Street, London,
> E1 6EL, United Kingdom
> Company Registration 3893360 VAT Number GB 752 1091 57
> Tel +44 207 456 1020
> Fax +44 870 1390 779
> Mobile +44 7960 726 016
> Email 
>



More information about the erlang-questions mailing list