[Haskell-cafe] Converting [Word8] to String
wolfgang at jeltsch.net
Tue Oct 4 05:04:59 EDT 2005
Am Sonntag, 2. Oktober 2005 12:52 schrieb Joel Reymont:
> How do I convert a list of bytes to a string?
> Cale has suggested a neat way of parsing binary packets in this thread:
> and I'm trying to create a packet reader for a Pascal-style string
> where the length is the first byte and the list of characters follows.
You seem to think that one byte has to correspond to one character but this
isn't the case in certain character encodings. In addition, even if one byte
corresponds to one character, a byte b doesn't necessarily denote a
character c with ord c == b. One has to take the encoding into account.
More information about the Haskell-Cafe