开发者

How to compile Qt library 4.7.1 with text codecs supported?

开发者 https://www.devze.com 2023-01-28 08:33 出处:网络
I\'ve successfully built static Qt library and I could see plugins/codecs/libqcncodecs.a, but I still can not use GB18030 like this:

I've successfully built static Qt library and I could see plugins/codecs/libqcncodecs.a, but I still can not use GB18030 like this:

QTextCodec::codecForName("GB18030")

and all I still couldn't find Chinese related codecs by

foreach (int mib, QTextCodec::availableMibs()) {
    QTextCodec *codec = QTextCodec::codecForMib(mib);

    QString sortKey = codec->name().toUpper();
    qDebug()<<sortKey;
}

That's the output of my app:

"SYSTEM" 
"UTF-8" 
"ISO-8859-1" 
"ISO-8859-15" 
"UTF-32LE" 
"UTF-32BE" 
"UTF-32" 
"UTF-16LE" 
"UTF-16BE" 
"UTF-16" 
"MULELAO-1" 
"ROMAN8" 
"TIS-620" 
"WINSAMI2" 
"APPLE ROMAN" 
"WINDOWS-1258" 
"WINDOWS-1257" 
"WINDOWS-1256" 
"WINDOWS-1255" 
"WINDOWS-1254" 
"WINDOWS-1253" 
"WINDOWS-1252" 
"WINDOWS-1251开发者_开发问答" 
"WINDOWS-1250" 
"IBM866" 
"IBM874" 
"IBM850" 
"ISO-8859-16" 
"ISO-8859-14" 
"ISO-8859-13" 
"ISO-8859-10" 
"ISO-8859-9" 
"ISO-8859-8" 
"ISO-8859-7" 
"ISO-8859-6" 
"ISO-8859-5" 
"ISO-8859-4" 
"ISO-8859-3" 
"ISO-8859-2" 
"KOI8-U" 
"KOI8-R" 
"ISCII-MLM" 
"ISCII-KND" 
"ISCII-TLG" 
"ISCII-TML" 
"ISCII-ORI" 
"ISCII-GJR" 
"ISCII-PNJ" 
"ISCII-BNG" 
"ISCII-DEV" 
"TSCII" 

How to add Chinese textcodecs?


The documentation says: "To link statically against those plugins, you need to use the Q_IMPORT_PLUGIN() macro in your application and you need to add the required plugins to your build using QTPLUGIN."

I think you are missing a Q_IMPORT_PLUGIN(qcncodecs) in your application.

0

精彩评论

暂无评论...
验证码 换一张
取 消