[Haskell-cafe] Unicode pretty-printing

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Sun Aug 29 06:49:41 EDT 2010


2010/8/29 Peter Gromov <gromopetr at gmail.com>:
> Thanks for getting back to me. I was imprecise, by UTF8 characters I
> mean Unicode. My source files are UTF8-encoded, and Haskell reads them
> fine, it only has problems outputting them in a readable way. At this
> point I'm not talking of any I/O besides plain console output.

How are you outputting them?  Unless you use a textual String I/O
function with GHC 6.12, then by default showing a String will print it
with escape characters for non-latin characters.

> Prelude> :load utest.hs
> [1 of 1] Compiling Main             ( utest.hs, interpreted )
> Ok, modules loaded: Main.
> *Main> main
> это тест
> *Main> runTestTT test1
> ### Failure:
> fail
> expected: *** Exception: <stderr>: hPutChar: invalid argument (Illegal
> byte sequence)

Hmmm... if you are using GHC 6.12, what's your locale?  I've only seen
error messages like that when using something with a different
encoding than your locale.

-- 
Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com
IvanMiljenovic.wordpress.com


More information about the Haskell-Cafe mailing list