We have a non-Unicode, C++ application, written with Visual Studio, that has been originally written for machines using the codepage 1252 character set.
Our application performs many post-processing steps on the contents of the resources after reading them, including looking up for resource strings in some files.
Now people in China are starting to use the application, and their machines use the PRC locale (which sets the default codepage for non-unicode applications to 936, which is a multibyte character set).
It appears that CString::LoadString
will perform some conversion. This breaks further processing because the content that we are looking for in the other files is not the same.
The same goes for CMenu::GetMenuString
or CWnd::GetWindowText
.
Badly enough, we cannot simply use iconv
on our files because LoadString
, GetMenuString
or GetWindowText
will behave this way:
- some characters which are valid in codepage 1252 are not valid in codepage 936 (e.g. î, û, ñ, œ) and get replaced with question marks
- some characters which are valid in codepage 1252 are not valid in codepage 936 (e.g. É) but get replaced with an alternate character (É => é)
- some characters exist in both codepages but do not have the same representation, often with two bytes in CP936
- some characters (including all ASCII characters) match in both codepages.
I would like that those three functions which load resource contents load the binary content, without performing any character set conversion. I have tried to modify the .rc
file with LANGUAGE LANG_INVARIANT, SUBLANG_NEUTRAL
but this did not change anything.
The resource file also includes a #pragma code_page(1252)
; can this be safely removed? What is that pragma for?
Thank you for your answers.