[Haskell-cafe] Re: getting crazy with character encoding

Stephane Bortzmeyer bortzmeyer at nic.fr
Wed Sep 12 10:35:50 EDT 2007


On Wed, Sep 12, 2007 at 04:18:43PM +0200,
 Andrea Rossato <mailing_list at istitutocolli.org> wrote 
 a message of 60 lines which said:

> Now, I would expect that the output of a shell command such as 
> "ls ab*"
> would be a string/list of 5 chars. 

I do not think this expectation is reasonable. I do not think that ls
is Unicode-aware. It probably has only bytes semantic, not characters
semantic.

> I would expect that a file name set in an utf-8 locale should be
> read by locale aware application

"locale aware application" is too vague. An application can use the
locale and still being unable to separate bytes from characters. ls
may be "locale aware" but it is probably not "Unicode aware".

>   l <- fmap lines $ runProcessWithInput "/bin/bash" [] "ls ab*"

This is not an Haskell issue but a ls issue. use
System.Directory.getDirectoryContents and we'll see.



More information about the Haskell-Cafe mailing list