I'm trying to format a CString using the following code:
const wchar_t * wch = L"μ";
CString str;
str.Format(_T("%c"), wch[0]);
However, instead of str having the value of "μ" it actually is set to "¼". When I debug it, it recognizes wch as "μ".
Further, if I do:
const wchar_t * wch = L"μ";
CString str;
str.Format(_T("%s"), wch);
it gives str with value "¼". (It doesn't seem to show up but there should be a superscript L after the ¼.)
The compiler is set to use unicode, as else where in the program I am able to call _T() and have it evaluate correctly, just not when formatting a CString.
What am I doing wrong?
*Edit: * Doing more debugging shows that the CString Format method's arglist receives a value of "Ü_"
μis 0x03BC. Interpret that as two single byte characters and you get¼which is 0xBC and superscript L which is 0x03. - Frank Boyne