You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I faced the need to unpack zero-terminated strings where each character is 2 bytes in big-endian (hi-lo) order, even as most all strings are ASCII range. So what i added to unpack is:
Nor do i handle correctly code points over 255. Which is a puzzle, how to correctly handle that in Lua? I am guessing the right thing would be to convert to UTF-8 for the internal string (which matches ASCII for <128). In any case - not production ready but existing need.
Not a solution, but in Lua, UTF code points are simply split into 8-bit values. What they are depends on the UTF encoding you're using (UTF-8/UTF-16BE/UTF-16LE), so you just have to know what you're working with to anticipate the byte order in the string.
Activity
NicoAdrian commentedon Jun 20, 2019
@EnTerr Hello, did you add anything else too ? I added your code to the unpack function by still can't decode utf 16 strings...
randomeizer commentedon Dec 4, 2019
Not a solution, but in Lua, UTF code points are simply split into 8-bit values. What they are depends on the UTF encoding you're using (UTF-8/UTF-16BE/UTF-16LE), so you just have to know what you're working with to anticipate the byte order in the
string.