Question

I'm working a legacy VC++6 app that is trying to add in unicode support, i have a function that calls into a rpc call that expects and unsigned char, if I use the W2CA() macro on the string being passed in, am i correct in assuming that there is a possibility of not being able to convert some unicode strings right? for example, I believe 我们的 T+G2 would be a problem. I just ask because I'm trying to decide if would be better off writing a wchar_t version.

thanks.

Was it helpful?

Solution

Yes you cannot expect Unicode to ANSI coversion to succeed with converting all the characters. You can use other encodings suchas UTF-8 instead of ANSI though.

A good entry point into MSDN for the question:

lpDefaultChar [in]

Optional. Pointer to the character to use if a character cannot be represented in the specified code page. The application sets this parameter to NULL if the function is to use a system default value. To obtain the system default character, the application can call the GetCPInfo or GetCPInfoEx function.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top