[Haskell-cafe] GHC rendering of non-ASCII characters configurable?

Ivan Lazar Miljenovic ivan.miljenovic at gmail.com
Mon Jul 30 15:45:38 CEST 2012

On 30 July 2012 04:04, Richard Cobbe <cobbe at ccs.neu.edu> wrote:
> I'm working on an application that involves processing a lot of Unicode
> data, and I'm finding the built-in Show implementation for Char to be
> really inconvenient.  Specifically, it renders all characters at U+0080 and
> above with decimal escapes:
>     Prelude> '\x80'
>     '\128'
> This is annoying because all of the Unicode charts give the code points in
> hex, and indeed the charts are split into different PDFs at numbers that
> are nice and round in hex but not in decimal.  So in order to figure out
> which character I'm looking at, I have to convert back to hex and then look
> it up in the charts.

Can I ask what you're doing here? Are you printing individual
characters or entire chunks of text?

putStrLn and similar IO-based functions (at least for me) will
un-escape characters if that helps.  Otherwise, are you using Text or

> Is there any way to ask GHC to render super-ASCII characters with their
> hexadecimal escapes, instead?  I'm perfectly happy to write my own custom
> Show instance, but I don't know how to hook that into ghci's REPL (or, for
> that matter, the routines that HUnit uses to generate the messages on
> failed tests, etc.).
> I'm using GHC 7.4.1 on MacOS 10.7.4.
> Thanks,
> Richard
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

Ivan Lazar Miljenovic
Ivan.Miljenovic at gmail.com

More information about the Haskell-Cafe mailing list