C++ Can't read UTF-8 cyrillic text from file

1.4k Views Asked by At

The file is UTF-8 (65001) encoded. I can't read cyrillic symbols from it.

CString FNAME;
CStdiofile fNFR;

fNFR.Open(_T("LFS200.25"), CFile::modeRead);
fNFR.ReadString(FNAME);

And got this:

 Зимний максимум 1989/90 гг.

instead of this:

 Зимний максимум 1989/90 гг.

Tried

setlocale(LC_ALL, "Rus");

Still the same problem.

How to get proper string?

1

There are 1 best solutions below

2
Nika_Rika On BEST ANSWER

I found the answer here (need to convert utf-8 to utf-16):

CONVERSION BETWEEN UNICODE UTF-16 AND UTF-8 IN C++/WIN32