
4 Oct
2005
4 Oct
'05
11:23 p.m.
Tomasz Zielonka wrote:
How do I convert a list of bytes to a string?
I assume you don't care about Unicode:
That should have said "I assume that the data is encoded using ISO-8859-1 (or a subset thereof, e.g. US-ASCII)".
map (Char.chr . fromIntegral)
or
map (toEnum . fromEnum)
For anything else, you will have to either to write a decoder (or use
someone else's; several exist for UTF-8), or interface to iconv()
using the FFI.
--
Glynn Clements