Reputation: 2443
I have a MFC dialog:
UNICODE and _UNICODE are defined.
class VerifyComp : public CDialog
{
public:
CString m_VerifyText;
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
};
void VerifyComp::DoDataExchange(CDataExchange* pDX)
{
m_VerifyText = L"Ø2.0 X 4.1";
pDx->m_bSaveAndValidate = 0;
DDX_Text(pDX, IDC_VERIFY_TEXT, m_VerifyText);
pDx->m_bSaveAndValidate = 1;
DDX_Text(pDX, IDC_VERIFY_TEXT, m_VerifyText);
}
The result is m_VerifyText == L"O2.0 X 4.1"; I expect m_VerifyText is unchanged.
How can I fix this?
Upvotes: 0
Views: 289
Reputation: 15162
The problem you are experiencing is that just because you have a wide-character literal does not mean the file itself can handle Unicode characters.
To fix this save the file using a Unicode character set. Go to File->Save As, right click on 'Save', select 'Save with encoding' then hit 'yes'. Now from the list of encodings choose one of the Unicode options (I generally prefer utf-8 with signature).
Upvotes: 0
Reputation: 2443
There's a property in the dialog .rc file that is causing the problem.
OEM Convert was set to true. It needs to be false.
Upvotes: 2