deoxxa / jsmc

Pure JavaScript Minecraft server
Other
82 stars 14 forks source link

ucs2 - wrong endianness #20

Closed andrewrk closed 11 years ago

andrewrk commented 11 years ago

According to wiki.vg strings are UCS-2 big endian.

jsmc uses the buffer api ucs2 which is an alias to utf16le.

Iconv can do the necessary conversions.

deoxxa commented 11 years ago

Before using the ucs2 string stuff, we reverse the byte order. It's cheap and (as far as I know) accurate. See the mcstring16 methods on both the parser and serialiser.

andrewrk commented 11 years ago

Sorry, I didn't realize that.

deoxxa commented 11 years ago

No problem! I'm happy someone is looking over the code, I'm sure there's a bunch of unclear/questionable things in there. :)