Hi Biterider!
By assembling in ANSI mode, these few modifications allow you to read UTF-8 or ANSI, even if it is not very efficient for ANSI (and always will save ANSI).
JSON_FILE_UTF8 equ 0
JSON_FILE_ANSI equ 1
Method Json.Read, uses xbx xdi xsi, pStream:$ObjPtr(Stream), xTipo:XWORD
local lMemBlockUTF8:XWORD
· · ·
mov xbx, $OCall(pStream::Stream.GetSize)
.if eax != -1
mov lMemBlockUTF8, xax
· · ·
.if xTipo == JSON_FILE_UTF8
invoke UTF8ToWide, pMemBlockWide, pMemBlockUTF8, ebx
.else
invoke MultiByteToWideChar,CP_ACP,0,pMemBlockUTF8,lMemBlockUTF8,pMemBlockWide, ebx
.endif
· · ·
MethodEnd
Regards, HSE.