[Haskell-cafe] Unicode strings and runCommand / runProcess

John Goerzen jgoerzen at complete.org
Fri Apr 23 13:44:29 EDT 2010


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.

Thoughts?

-- John


More information about the Haskell-Cafe mailing list