1、
bool TdrawSvg::Save2File(char* _pcFullFileName) { // http://blog.csdn.net/u011314012/article/details/49861363 // https://stackoverflow.com/questions/4780507/create-utf-8-file-in-qt QString str = FpOwnerWebView->page()->currentFrame()->toHtml(); //QString unicodeString = "Some Unicode string"; QFile fileOut("C:\zzz.svg"); //if (!fileOut.open(QIODevice::WriteOnly | QIODevice::Text | QFile::Truncate)) if (! fileOut.open(QFile::WriteOnly | QFile::Truncate)) return false; QTextStream streamFileOut(&fileOut); streamFileOut.setCodec("UTF-8"); streamFileOut << str; streamFileOut.flush(); // ZC: 查到说,下面的参数是true的话 就是保存成"UTF-8 + BOM",false的话 就是保存成"UTF-8" // 但是,我尝试了一下,都是"UTF-8"... 不知为啥... streamFileOut.setGenerateByteOrderMark(true); fileOut.close(); }
2、
3、