[Haskell-cafe] Unicode strings and runCommand / runProcess
Khudyakov Alexey
alexey.skladnoy at gmail.com
Fri Apr 23 17:35:06 EDT 2010
В сообщении от 23 апреля 2010 21:44:29 John Goerzen написал:
> Here is a very interesting little problem.
>
> 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
>
> This is a minimal test case for a bug reported in HSH at
> http://github.com/jgoerzen/hsh/issues#issue/1
>
> It is not entirely clear to me what the behavior here should be. It
> seems inconsistent with the default behavior of System.IO to,
> apparently, just strip the bits higher than 0xFF. On the other hand,
> when it's OS commands we're talking about, it's not entirely clear to me
> if the default should be to encode in UTF-8. There should almost
> certainly be an *option* controlling this, and perhaps a version of
> runProcess that accepts ByteStrings.
>
It should just use system locale for encoding like System.IO do.
FYI I just submitted bug to GHC trac:
http://hackage.haskell.org/trac/ghc/ticket/4006
P.S. Haskell libraries aren't very well designed with respect to unicode and
company.
More information about the Haskell-Cafe
mailing list