The MASM Forum

General => The Campus => Topic started by: mabdelouahab on March 22, 2016, 05:41:07 AM

Title: text decoding
Post by: mabdelouahab on March 22, 2016, 05:41:07 AM
how to convert a text from Windows-1256 to Unicode? Any method or API function

Windows 1256 (https://msdn.microsoft.com/en-us/goglobal/cc305149.aspx)
Title: Re: text decoding
Post by: jj2007 on March 22, 2016, 06:38:37 AM
MultiByteToWideChar
Title: Re: text decoding
Post by: mabdelouahab on March 22, 2016, 07:32:11 AM
Thank you jj2007 ; I forgot it  :P
Title: Re: text decoding
Post by: Mikl__ on March 22, 2016, 12:50:31 PM
Hi, mabdelouahab!
When I need to transfer the text from the Windows-1251 (https://msdn.microsoft.com/en-us/goglobal/cc305144.aspx) code to Unicode I use a macro du
du macro string
local bslash
bslash = 0
irpc c,<string>
if bslash eq 0
if '&c' eq "/"
        bslash = 1
elseif '&c'gt 127
db ('&c'- 0B0h),4
else
dw '&c'
endif
else
           bslash = 0
           if '&c' eq "n"
           DW 0Dh,0Ah
           elseif '&c' eq "/"
           dw '/'
           elseif '&c' eq "r"
           dw 0Dh
           elseif '&c' eq "l"
           dw 0Ah
           elseif '&c' eq "s"
           dw 20h
           elseif '&c' eq "c"
           dw 3Bh
           elseif '&c' eq "t"
           dw 9
   endif
endif
endm
dw 0
endm
for example wHello: du <Hello, world>