Windows Vista Beta | WinVistaBeta.com - Message | Converting character streams to Unicode

May 12, 2008  
Subject: Converting character streams to Unicode
Group: microsoft.public.msdn.general
Date: 4/10/2008 7:06:21 AM
From: "Keith MacDonald" [Email Address Protection]

MultiByteToWideChar does not seem to be an appropriate API for converting
DBCS or UTF-8 streams to UTF-16, because it requires an integral number of
those characters in its source buffer. However, .Net has a Decoder class,
which is documented as follows:

"A Decoder object maintains state information between successive calls to
GetChars or Convert() methods so it can correctly decode byte sequences that
span blocks. The Decoder also preserves trailing bytes at the end of data
blocks and uses the trailing bytes in the next decoding operation.
Therefore, GetDecoder and GetEncoder are useful for network transmission and
file operations because those operations often deal with blocks of data
instead of a complete data stream."

That's exactly what I need, but I don't want to use .Net. Is there a way of
achieving the same result using a Windows API?

Thanks.



Back