fi wrote:
My problem is, that the server sends UTF-16 encoded characters. If I read them as a stream of raw bytes, then the buffer does not contain the proper data. In fact, in every word high and low order Byte seem to be reversed.
UTF-16 can be either little- or big-endian. I assume you're trying to interpret it the wrong way. Is there a byte order mark at the beginning?
To get the value as an integer, you can just do: (buf[0] | (buf[1] << 16)) or in the big-endian case: ((buf[0] << 16) | buf[1]) -- All the world's a stage, And all the men and women merely players: They have their exits and their entrances; And one man in his time plays many parts, [...] --W. Shakespeare _______________________________________________ dev-tech-xpcom mailing list [email protected] https://lists.mozilla.org/listinfo/dev-tech-xpcom
