Risks of running on single byte character app on a MBCS OS
-
27-10-2019 - |
Question
I have an MFC application where the Character Set is "Not Set". What are the risks associated with running this application on a OS that has a Multi Byte Character Set code page?
Solution
The "Character Set: Not Set" option defines neither _MBCS
nor _UNICODE
. That means that you're using the *A series of functions. Those will return MBCS strings, even when _MBCS
is not defined.
If _MBCS
doesn't affect the strings returned from the *A functions, then what does it do? It maps some <tchar.h>
tcs*
functions to their mbs*
versions, instead of the str*
or wcs*
variants. E.g. without _MBCS
, _tcsrev
maps to strrev
, not _mbsrev
.
Therefore, you may not be able to reverse the multi-byte strings you receive from the OS, or edit them otherwise.
OTHER TIPS
The risks are:
1) If you use non-English texts, and the user enters, say, Russian, some Russian characters that are not mapped to MBCS or require a Charset layer, will be retrieved as '?'
2) You need to inform the customer that the App. accepts English-only and no guarantee the App, when entering non-English characters, would accept or retrieve non-English texts correctly.
3) Any texts with foreign language characters may lead to unwanted or undesired conversion of accents and diacritics to something else.