Re: UNICODE to MBCS



I'm trying to figure out if I need to do anything special inorder to
read unicode into a dll written using MBCS. We have string files that
are saved as Unicode (UTF-16) and we are forced to load these files
into a dll that is compiled using MBCS. Do we need to run
WideCharToMultiByte on everything that comes back? We are using
GetPrivateProfileString when reading from the file if that makes a
difference.

Matt,

The MSDN documentation for the corresponding WritePrivateProfileString
mentions:

"If the file was created using Unicode characters, the function writes
Unicode characters to the file. Otherwise, the function writes ANSI
characters.
"

.... so I'd expect GetPrivateProfileString would behave in the same
manner - though I've never explicitly checked it. Why not write a few
lines of code and check it?

Furthermore, does anyone know of any problems with doing this? Are
there certian characters that will become lost in translation?

Undoubtedly, where there's any Unicode -> MBCS translation, if the
characters are not available in the code page they will be
substituted.

Dave
.



Relevant Pages

  • Re: How to Get the ByteLength from CString when it is Unicode
    ... UTF8 is one of many MBCS encodings. ... Unicode is not an MBCS; UTF8 is (or at least the WideCharToMultiByte API call thinks it ... The number of characters is based on interpreting 'character' as WCHAR in Unicode and CHAR ...
    (microsoft.public.vc.mfc)
  • Re: Unicode Support
    ... >> (I know this is a poor example, but think about other languages, eg ... First things first, when you register your RosAsm windows classes, you ... the messages with ANSI / UNICODE parameters in ANSI or UNICODE form... ... with their alphabet characters, as with the numbers and punctuation...so, ...
    (alt.lang.asm)
  • =?windows-1252?Q?Re=3A_Encrypting_Unicode_=96_Using_ASCII_as_a_Surrogat?= =?windows-1252?Q?e
    ... characters of an exotic eastern language using an ASCII keyboard. ... communicate in large volume with China or Japan using CJK from Unicode ... present the message text to Alice as a string of hexadecimal numbers ... by the computer as an external file and enciphered by a stream cipher ...
    (sci.crypt)
  • =?windows-1252?Q?Encrypting_Unicode_=96_Using_ASCII_as_a_Surrogate_Al?= =?windows-1252?Q?pha
    ... characters of an exotic eastern language using an ASCII keyboard. ... It is true to say that any keyboard of any language can be simulated ... communicate in large volume with China or Japan using CJK from Unicode ... by the computer as an external file and enciphered by a stream cipher ...
    (sci.crypt)
  • =?windows-1252?Q?Re=3A_Encrypting_Unicode_=96_Using_ASCII_as_a_Surrogat?= =?windows-1252?Q?e
    ... characters of an exotic eastern language using an ASCII keyboard. ... communicate in large volume with China or Japan using CJK from Unicode ... present the message text to Alice as a string of hexadecimal numbers ... by the computer as an external file and enciphered by a stream cipher ...
    (sci.crypt)