[Haskell-cafe] Unicode strings and runCommand / runProcess

Khudyakov Alexey alexey.skladnoy at gmail.com
Fri Apr 23 20:26:53 EDT 2010

В сообщении от 24 апреля 2010 03:50:54 John Goerzen написал:
> Ivan Lazar Miljenovic wrote:
> > John Goerzen <jgoerzen at complete.org> writes:
> >> ghci
> >> GHCi, version 6.12.1: http://www.haskell.org/ghc/  :? for help
> >> Loading package ghc-prim ... linking ... done.
> >> Loading package integer-gmp ... linking ... done.
> >> Loading package base ... linking ... done.
> >> Prelude> :m System.Process
> >> Prelude System.Process> runCommand "echo привет"
> >> ?@825B
> >
> > Are you arguing about IO-specific stuff like this, or for all non-ASCII
> > Strings?
> I'm not sure I understand the question.  I consider the behavior in
> System.IO to be well-documented.  The behavior in System.Process is not
> documented at all.  As I said, I'm not certain what the proper answer
> is, but not documenting what happens probably isn't it.
> Actually, the behavior of openFile when given a String with characters >
> 0xFF is also completely undocumented.  I am not sure what it does with
> that.  It should probably be the same as runCommand, whatever it is.
Under unices file names are just array of bytes. There is no notion of encoding 
at all. It's just matter of interpretation of that array. 

There is a problem with FilePath data type. It's String actually but it should 
be abstract data type. There is relevant bug[1] on GHC trac.

P.S. openFile truncates Chars.

[1] http://hackage.haskell.org/trac/ghc/ticket/3307

More information about the Haskell-Cafe mailing list