I'm asking this more out of curiosity.
Considering this code snippet:
CStringA narrow;
CStringW wide;
...
wide = narrow; // which code page is used for the conversion
// of the narrow string to wide string?
Which code page is used for the conversion of the CStringA
string to CStringW
? It appears to use the CP_ACP
code page, but is this guaranteed?
Instead of wide = narrow;
I'm actually using wide = CA2W(narrow, CP_ACP);
, so I can specify explicitly the desired code page.
Disclaimer: I know that wide strings should be used all over the place, but this is used for a MBCS legacy software.
ATL is open source. ATL StringT
uses _AtlGetConversionACP()
:
inline UINT WINAPI _AtlGetConversionACP() throw()
{
#ifdef _CONVERSION_DONT_USE_THREAD_LOCALE
return CP_ACP;
#else
return CP_THREAD_ACP;
#endif
}