Databuffer.PeekString issue
Opened this issue · 1 comments
jondecker76 commented
Please see forum post here:
http://monkeycoder.co.nz/forums/topic/help-porting-hmac-sha256-code/#post-15930
String characters $80 to $FE are returned as $FF80 to FFFE. There is no $FF character at all, and $00 is returned. This makes any type of string based encryption/hashing very difficult. Is this a bug?
D-a-n-i-l-o commented
Strings in Monkey2 support Unicode and each Character uses 16Bit = 2 Bytes.
Your code looks to me like you assume ASCII-Strings?
Maybe there should be some more PeekString() functions to catch different String representations from DataBuffer.
DataBuffer.PeekString(offset, count, StringFormat.ASCII )
DataBuffer.PeekString(offset, count, StringFormat.UTF8 )
DataBuffer.PeekString(offset, count, StringFormat.UTF16 )
...
Currently it looks like PeekString() indeed catches ASCII chars, but that would be wrong imo.