unicode - how to convert

Started by
5 comments, last by LessBread 17 years, 9 months ago
I have a prog in multibyte and want to convert to unicode so i can use some dxut api's. what is imvolved and it is hard to do.
Advertisement
What do you mean? Multibyte as in 16 bit characters? What do you mean by Unicode? Unicode doesn't care about how the characters are stored, and there are lots of different encodings for it.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
Quote:Original post by smart_idiot
What do you mean? Multibyte as in 16 bit characters? What do you mean by Unicode? Unicode doesn't care about how the characters are stored, and there are lots of different encodings for it.


well the character set in the proeprty pages has multibyte and if you set to unicode then I get an error. To get a program to compile with unicode what do i do as I can't see any strings I have defined.

If I create a solution and create a basic win32 program then it won't compile in unicode.

Quite a simple/basic question to be frank.

for string literals, put a capitol L in front of them. L"unicode string"

if you want to convert existing strings to unicode, try MultiByteToWideChar
if you take out all the string literals L"__" to just "__" then that is good enough in ansi, I take it.
You could try listing your compile errors. Might make it a bit easier to help. [wink]
These might help. YMMV

// ----------------------------------------------------------------------------////BOOL WINAPI UnicodeToAnsi(    LPWSTR pszwUniString,    LPSTR  pszAnsiBuff,    DWORD  dwAnsiBuffSize    ){    int iRet = 0;    iRet = WideCharToMultiByte(        CP_ACP,        0,        pszwUniString,        -1,        pszAnsiBuff,        dwAnsiBuffSize,        NULL,        NULL        );    return ( 0 != iRet );}// ----------------------------------------------------------------------------////BOOL WINAPI AnsiToUnicode(    LPSTR  pszAnsiString,    LPWSTR pszwUniBuff,    DWORD dwUniBuffSize    ){    int iRet = 0;    iRet = MultiByteToWideChar(        CP_ACP,        0,        pszAnsiString,        -1,        pszwUniBuff,        dwUniBuffSize        );    return ( 0 != iRet );}

"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

This topic is closed to new replies.

Advertisement