如圖1-1,1-2,檔案創建時,格式為utf-8,寫入檔案后,格式變為ANSI,請問如何保持不變,仍然為:utf-8.

string strFile="c:\\utf-8test11.txt";
//step1:創建utf-8檔案
FILE *fp= fopen(strFile.c_str(),"w,ccs=UTF-8"); //new file
assert(fp != NULL);
fclose(fp);
//step2:寫入內容
std::fstream fout;
fout.open(strFile.c_str(),std::ios_base::_Nocreate|std::ios_base::out); //默認讀寫,普通檔案
fout << "china";
fout.close();
//step3:檔案另存為,編碼格式已經為:ANSI,為什么
uj5u.com熱心網友回復:
Google "fstream UTF-8"http://mariusbancila.ro/blog/2008/10/20/writing-utf-8-files-in-c/
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/133511.html
標籤:基礎類
上一篇:java程式與c++builder程式網路通訊時候傳輸中文字符亂碼問題
下一篇:開源專案檔案撰寫的各種疑問
