[erlang-questions] UTF8

Dustin Whitney dustin.whitney@REDACTED
Tue Feb 12 17:21:07 CET 2008


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 <hasan.veldstra@REDACTED> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080212/7d8dc452/attachment.htm>


More information about the erlang-questions mailing list