如何编译支持文本编解码器的 Qt 库 4.7.1?

发布于 2024-10-06 09:14:53 字数 1114 浏览 7 评论 0原文

我已经成功构建了静态Qt库,我可以看到plugins/codecs/libqcncodecs.a,但我仍然无法像这样使用GB18030:

QTextCodec::codecForName("GB18030")

而且我仍然找不到中文相关的编解码器,

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

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

这就是我的应用程序的输出:

"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" 

如何添加中文文本编解码器?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

独﹏钓一江月 2024-10-13 09:14:53

文档说:“要静态链接这些插件,您需要在您的应用程序中使用 Q_IMPORT_PLUGIN() 宏,并且您需要使用 QTPLUGIN 将所需的插件添加到您的构建中。”

我认为您的应用程序中缺少 Q_IMPORT_PLUGIN(qcncodecs)

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文