My world is: MFC, Visual Studio C++, using MBCS character set. Generally using CString as my favorite string type, but sometimes std:string as well.
I can put German words in my string table and they show up in the GUI just fine - full of lovely umlauts and other accents. But if I have a *.txt file containing German text with umlauts, when I read it in (using CStdioFile) and then show it in the GUI, the umlauts and other special characters do not print nicely, instead things like für showing up (should be "fur" with an umlaut on the u).
How can I read a *.txt file of German text and show it in the GUI? Thought this was simple. I could swear I've done it before without issue. Thanks in advance for your help!
The problem is probably that your input file is encoded in UTF-8, whereas your viewer is interpreting it as a single-byte encoding using code page Windows-1252.
When encoding the string
fürin UTF-8, you get the following bytes:
0x66 0xc3 0xbc 0x72The characters
fandrare each encoded into one byte, whereas the characterüis encoded into two bytes.These bytes correspond to
fürin code page Windows-1252.
In your question, you stated that
füris the output that you are getting for the stringfür. Therefore, what I have stated seems to be the most obvious explanation for the output.