'Windows MFC controls get randomly wrong characters

This is an interesting one. I'm in the process of going from satellite DLLs to GNU gettext for translation and encountered this interesting problem. I have tried with hard coded string so gettext isn't the cause of it.

Example of inconsistent encoding

Here the strings are trated differently in the same menu. "Välj test" and "Stäng test" both contain the same character (ä), but one is displayed correctly while one isn't. When lookin in debugger both strings look fine, but Spy++ confirms that one is wrong. No idea what's going n here.

I'm using MFC in C++ and use Visual Studio 2010 (it's an old project). It's set to Unicode.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source