I try to read a file via MFC:
CString string;
CStdioFileEx gameFile;
bool have_file = false;
if (PathFileExists(filePathsAndNames[i].first + L"\\main.lua"))
{
gameFile.Open(filePathsAndNames[i].first + L"\\main.lua", CFile::modeRead);
have_file = true;
}
else if (PathFileExists(filePathsAndNames[i].first + L"\\main3.lua"))
{
gameFile.Open(filePathsAndNames[i].first + L"\\main3.lua", CFile::modeRead);
have_file = true;
}
if (have_file)
{
gameFile.SetCodePage(CP_UTF8);
CString game_name;
CString game_name_en;
CString game_author;
CString game_version;
const int MAX_STR_CNT = 5; //не больше этого количества строк от начала
int curr_str = 0;
while (gameFile.ReadString(string)) {
...
}
}
When a file has UTF-8 encoding without a BOM, the readString()
method skips near two, three characters in the first line. When the file has UTF-8 encoding with a BOM, all is ok.
How can I fix it?
Is it an issue which I should report to Microsoft? If yes, how can I do it?