查看完整版本: [-- 在QT里怎样实现编码的互转? --]

QTCN开发网 -> Qt中文处理 -> 在QT里怎样实现编码的互转? [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

vbuser 2015-08-16 22:32

在QT里怎样实现编码的互转?


如下面的功能:
[attachment=14244]
希望坛里的高手能出出手

leonchiong 2015-08-17 08:47
    QString str = QString("文");
    qDebug() << str;
    qDebug() << "ANSI" << str.toLocal8Bit().toHex();
    qDebug() << "Unicode" << QString::number(str.data()->unicode(),16);
    qDebug() << "UTF-8" << str.toUtf8().toHex();

vbuser 2015-08-17 16:36
谢谢,高手就是高手,几行就搞定了!

vbuser 2015-08-17 16:40
[attachment=14248]其他的编码对的,就是Unicode出来的好像是反的,"文" 是8765


查看完整版本: [-- 在QT里怎样实现编码的互转? --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled