[Haskell-cafe] Re: Strings and utf-8

Thomas Hartman thomas.hartman at db.com
Thu Nov 29 10:52:25 EST 2007

A translation of 


from perl to haskell would be a very useful piece of documentation, I 

That explanation really helped me get to grips with the encoding stuff, in 
a perl context.


Duncan Coutts <duncan.coutts at worc.ox.ac.uk> 
Sent by: haskell-cafe-bounces at haskell.org
11/29/2007 07:44 AM

Maurí­cio <briqueabraque at yahoo.com>
haskell-cafe at haskell.org
Re: [Haskell-cafe] Re: Strings and utf-8

On Wed, 2007-11-28 at 17:38 -0200, Maurí­cio wrote:
> >>(...)  When it's phrased as "truncates to 8
>  >> bits" it sounds so simple, surely all we need
>  >> to do is not truncate to 8 bits right?
>  >>
>  >> The problem is, what encoding should it pick?
>  >> UTF8, 16, 32, EBDIC? (...)
>  >>
>  >> One sensible suggestion many people have made
>  >> is that H98 file IO should use the locale
>  >> encoding and do Unicode/String <-> locale
>  >> conversion. (...)
> I'm really afraid of solutions where the behavior
> of your program changes with an environment
> variable that not everybody has configured
> properly, or even know to exist.

Be afraid of all your standard Unix utils in that case. They are all
locale dependent, not just for encoding but also for sorting order and
the language of messages.

Using the locale is standard Unix behaviour (and these days the locale
usually specifies UTF8 encoding). On OSX the default should be UTF8. On
Windows it's a bit less clear, supposedly text files should use UTF16
but nobody actually does that as far as I can see.


Haskell-Cafe mailing list
Haskell-Cafe at haskell.org


This e-mail may contain confidential and/or privileged information. If you 
are not the intended recipient (or have received this e-mail in error) 
please notify the sender immediately and destroy this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20071129/4b87ca44/attachment-0001.htm

More information about the Haskell-Cafe mailing list