
4 Oct
2005
4 Oct
'05
9:04 a.m.
Am Sonntag, 2. Oktober 2005 12:52 schrieb Joel Reymont:
Folks,
How do I convert a list of bytes to a string?
Cale has suggested a neat way of parsing binary packets in this thread:
http://www.mail-archive.com/haskell-cafe@haskell.org/msg09413.html
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.
[...]
Best wishes, Wolfgang