Search code examples
c++encodingrtfansi

How to make C++ not to lose accents while assignment?


I have a program, that takes an .rtf file, reads it, and then creates a new .rtf file to write there some lines from the first document.

The problem is that it loses non-ascii characters.

The program gets a line from .rtf with fgetws(strBuff, ...), and the line it gets is correct.

But then it does an assignment strIn = strBuf, and in strIn we see "u" instead of "ü", "a" instead of "ä", "o" instead of "ö" and "?" instead of "ß" (these are German extensions to the 7-bit ascii standard).

Now can we make C++ not to lose all of this while assignment?


Solution

  • Oh, I've found it. strIn was a CStringA while strBuff was CString. I'm working with C++ the second day so it was a bit tough to solve this simple example. Sorry for not providing enough information, I was working without types too much =__=