简体   繁体   中英

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

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM