If we save our file in UTF-8 than we must add 3 BOM char first and than write data that we want to save in file.
For Example:
char strUTF8[] = { unsigned char(0xEF), unsigned char(0xBB), unsigned char(0xBF),'\0' };
CStdioFile m_OutPutFile;
m_OutPutFile.Open(strOPfileName,CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
m_OutPutFile.Write(strUTF8,strlen(strUTF8)*sizeof(char));
m_OutPutFile.Close();