How do I convert a unicode code point into a UTF-16 encoded string in Visual C++ 6?
I believe there is a .net function called ConvertFromUtf32 which does what I want.
Printable View
How do I convert a unicode code point into a UTF-16 encoded string in Visual C++ 6?
I believe there is a .net function called ConvertFromUtf32 which does what I want.
You can simply insert the 16-bit hexadecimal codes into a UNICODE string literal by escaping them with "\x" (provided that your project is built for UNICODE):Quote:
Originally Posted by Bob H
Code:LPCTSTR str = _T("Some text: \x00C4\x00D6\x00DC");
Thank you. I have been searching for days on how to do this.
How do I go the other direction -- from a unicode string to code points?
I am still struggling with the first problem. You created a string using hex constants. How do I create that string if the code points are variables? In other works, how do I form an escaped hex number programmically?
For example, the following won't work:
TCHAR buffer[10];
_stprintf(buffer, _T("%04x"), uCode);
CString sHex = buffer;
CString sEscaped = _T("\x") + sHex;