
Originally Posted by
DaveDavis
StrConv Replacement? LCMapStringEx API is the core.
I guess that StrConv internally uses the API LCMapStringEx to convert strings, or?
My problem is that StrConv and LCMapStringEx using a language locale to convert the text and this will screw up the text on a windows system with the option for non-unicode programs set to a unicode language like chiese, russian, etc.
example:
i read the whole content of a small file into a byte array buffer and convert the buffer to a string:
Code:
hFile = CreateFileWide(sFile, GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, 0, 0)
ReadFile(hFile, bBuffer(0), lBufferLen, lBytesRead, 0)
sText = StrConv(bBuffer, vbUnicode)
This code works fine on any windows system if the windows option for non-unicode programs is set to a non-unicode language like english:

If the windows option for non-unicode programs is set to a unicode language like chinese some characters in the text are converted wrong:

Thats the reason i need a function to convert the buffer to a VBstring without using a locale language ID.
I just want to convert the raw data from the buffer without any special language conversion.
I guess this must be somehow possible. Maybe parsing the whole buffer by step 2 and convert every 2 bytes into a vbstring...
I checked the encoding of the files with notepad: some are encoded with ANSI and some with UTF8.