How to work around GHC bug

Donn Cave donn at
Wed Mar 14 16:19:33 CET 2012

Quoth Volker Wysk <pf3 at>,
> I'll report this as a bug in the GHC Trac. But for now, I need to work around 
> the problem somehow. The encoders in GHC.IO.Encoding all work on buffers. How 
> do I recode the command line, in order to get proper Unicode strings?

Data.Text might work for you.  I'm not guaranteeing that you'll get
a "proper Unicode string" out of this, but you'll get a String with
one (LATIN-1) value per character:

import qualified Data.ByteString.Char8 as P
import Data.Text.Encoding (decodeUtf8)
import qualified Data.Text as T

let arghs = ["\195\164"]
let args = map (T.unpack . decodeUtf8 . P.pack) arghs


More information about the Glasgow-haskell-users mailing list