[Haskell-beginners] Simple UTF-8 output

Elvio Toccalino elviotoccalino at gmail.com
Fri May 27 06:59:22 CEST 2011


I usually pull such values as ByteStrings. The utf8-strings package
provides printing functions for such data.
Also, if you'd like to work on it as Text, there's the
Data.Text.Encodings module, to decodeUTF8 or decodeASCII ByteString's
into Text.

On Thu, 2011-05-26 at 20:54 -0800, Christopher Howard wrote:
> Hi. I'm trying to print out UTF-8 strings (pulled from a MySQL database
> through HDBC.ODBC). If I just print them out, the extended characters
> are printed out as question marks. If I use show on them (which is what
> I want to do in this case) they are printed as \NNNNN... (presumably the
> Unicode number).
> 
> Google brought up hundreds of topics for "Haskell utf-8" but its like
> looking for a single tree in a forest.
> 
> I took great care to ensure my Gentoo Linux system is UTF-8 ready, and I
> can type or echo utf-8 characters on the command line just fine.
> 
> # locale
> LANG=en_US.UTF-8
> LC_CTYPE="en_US.UTF-8"
> LC_NUMERIC="en_US.UTF-8"
> LC_TIME="en_US.UTF-8"
> LC_COLLATE="en_US.UTF-8"
> LC_MONETARY="en_US.UTF-8"
> LC_MESSAGES="en_US.UTF-8"
> LC_PAPER="en_US.UTF-8"
> LC_NAME="en_US.UTF-8"
> LC_ADDRESS="en_US.UTF-8"
> LC_TELEPHONE="en_US.UTF-8"
> LC_MEASUREMENT="en_US.UTF-8"
> LC_IDENTIFICATION="en_US.UTF-8"
> LC_ALL=
> 





More information about the Beginners mailing list