Hi, I have an app that is required to run with some extended characters, such as the characters defined in Latin-1 Supplement and, possibly, Latin Extended-A, as described in Unicode ( see http://en.wikipedia.org/wiki/List_of_Unicode_characters,
for example), so my compiler is set to use the Unicode character set.
I get an std::string that includes such characters ( e.g. "ú", "é", and others), and I need to output a wchar_t*.
Can wchar_t* even handle these characters?
This is how I usually convert:
std::string input = "Bancé";
std::wstring wCmd = std::wstring(cmd.begin(), cmd.end()); //(1)
WCHAR* wCCmd = const_cast<WCHAR*>(wCmd.c_str()); // wchar_t typedef
SQLWCHAR* output = wCCmd; //wchar_t typedef
I am using windows typedefs, but WCHAR* and SQLWCHAR* are just the same type wchar_t*, i.e. what I want as out.
This conversion usually works, but, for the case where I have a string, such as "Bancé" above,
at step (1) (i.e. conversion from std::string to std::wstring), the extended character "é" becomes "￩", (i.e. "Bancé" becomes "Banc￩").
What can I do to use extended Unicode characters (at least Latin-1 Supplement, and possibly, Latin Extended-A) in my std::wstring and the types that follow it?
(I guess it comes down to converting a char that supports these characters to a wchar_t that supports these characters, but, in the end, I am using std::string as input, so I kept it that way in code).
Does it depend on my compiler settings, or something else entirely?
Thanks for any help!!! :)