So is running but xml is no utf8 ..... or no unicode....
i like text on xml file so on server cms.... (i tested tidy or qt4 asci and textstream codec)
I have a php function "utf8_to_unicode" but is not possibel to run on qt4 ....
original function unicode xml files ... http://ppk.ciz.ch/format/qt/Multi_Language.phps

Is not possibel to post this text on forum.... on post rewrites....
The reusult on the cms i can write any language.... this is text from image...
提契诺州的美味佳肴具有意大利风格,同时具有自己的独特之处。纯正的本地风味可以在这个地区特有的"tra ttorie", "grotti"(客栈)或是餐馆中享用,它们都是流行的聚会场所,最初却是冬季出售葡萄酒和熟食 的小店。
提契诺葡萄酒中的极品无疑当数源自法国波尔多地区的墨尔乐红葡萄酒。自19世纪初开始从法国引进这种葡萄酒 以取代当地葡萄酒以来,墨尔乐葡萄酒就适应了提契诺州的气候,并在这里取得了辉煌的成功。
{
qDebug() << "### open file " << inputfile;
if (file.exists()) {
qDebug() << "### file found ok " << inputfile;
inside =file.readAll();
file.close();
}
}
root.setAttribute("xmlns:s","http://www.pulitzer.ch/2005/shop/shema/1.0/");
root.setAttribute("xmlns:cms","http://www.pulitzer.ch/2005/PuliCMS/1.0/");
doc.appendChild(root);
page.setAttribute("xmlns:cms","http://www.pulitzer.ch/2005/PuliCMS/1.0/");
page.setAttribute("la",set_lang);
QDomText t
= doc.
createTextNode(inside
);
page.appendChild(t);
root.appendChild(page);
qDebug() << "### xml result " << ilmiofile.data();
return ilmiofile.data();
}
QString Gui_Tidy::Createtag(QString inputfile,QString set_lang)
{
QString inside="File not found!";
qDebug() << "### open file " << inputfile;
QFile file(inputfile);
if (file.exists()) {
qDebug() << "### file found ok " << inputfile;
if (file.open(QFile::ReadOnly | QFile::Text)) {
inside =file.readAll();
file.close();
}
}
QDomDocument doc("");
QDomElement root = doc.createElement("root");
root.setAttribute("xmlns:s","http://www.pulitzer.ch/2005/shop/shema/1.0/");
root.setAttribute("xmlns:cms","http://www.pulitzer.ch/2005/PuliCMS/1.0/");
doc.appendChild(root);
QDomElement page = doc.createElement("cms:page");
page.setAttribute("xmlns:cms","http://www.pulitzer.ch/2005/PuliCMS/1.0/");
page.setAttribute("la",set_lang);
QDomText t = doc.createTextNode(inside);
page.appendChild(t);
root.appendChild(page);
QString xml = doc.toString();
QByteArray ilmiofile = xml.toAscii();
qDebug() << "### xml result " << ilmiofile.data();
return ilmiofile.data();
}
To copy to clipboard, switch view to plain text mode
Only this qt function transorm a xml utf8 ... but on qtextedit show normal iso....
bool Gui_Tidy
::file_put_contents_utf8(QString fullFileName,
QString xml
) {
/*QTextCodec *codeclatin1 = QTextCodec::codecForMib(4);*/
{
sw.setCodec(codecutf8);
sw << data;
f.close();
return true;
}
return false;
}
bool Gui_Tidy::file_put_contents_utf8(QString fullFileName,QString xml)
{
QTextCodec *codecutf8 = QTextCodec::codecForMib(106);
/*QTextCodec *codeclatin1 = QTextCodec::codecForMib(4);*/
QString data = xml+"\n";
QFile f( fullFileName );
if ( f.open( QFile::WriteOnly | QFile::Text ) )
{
QTextStream sw( &f );
sw.setCodec(codecutf8);
sw << data;
f.close();
return true;
}
return false;
}
To copy to clipboard, switch view to plain text mode
Bookmarks