[erlang-questions] UTF8

Robert Virding <>
Wed Feb 13 23:44:21 CET 2008


It is if they had kept of the old 9-bit bytes (characters) from DEC-10 days.
In those days you also had a real ctrl-key which set the 9th bit. :-)

Robert

On 13/02/2008, Alex Arnon <> wrote:
>
> My guess would be that 332 is not a valid value for a byte :)
>
> 2008/2/12 Dustin Whitney <>:
>
> > Yeah, that worked thanks!  I had tried what you did, but it did not work
> > with the UTF-32 data.  Do you know why?  And how do you suppose my data was
> > turned into UTF-32.  I got the data originally from an HTTP GET request that
> > returned a UTF-8 encoded XML file.  The file its self says it's UTF-8, and
> > the header tuple said the document was using the UTF-8 charset.  Does Erlang
> > convert the data automatically?
> > Thanks!
> > -Dustin
> >
> >
> > On Feb 12, 2008 2:59 AM, Hasan Veldstra <>
> > wrote:
> >
> > >
> > > > How can I write [332,116,97,44,32,71,117,110,109,97] to a file so
> > > > that when I open it up it looks like "Ōta, Gunma"?
> > >
> > >
> > > -module(ftest).
> > > -export([run/0]).
> > >
> > > run() ->
> > >     Data = [197,140,116,97,44,32,71,117,110,109,97],
> > >     file:write_file("ftest.txt", list_to_binary(Data)).
> > >
> > >
> > > Text is just numbers when stored to disk.
> > >
> > > By the way, the list of numbers you originally posted is "Ōta, Gunma"
> > > encoded in UTF-32, not UTF-8. It's in UTF-8 in my example.
> > >
> > > Hope this helps.
> >
> >
> >
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080213/37a2ecb2/attachment.html>


More information about the erlang-questions mailing list