QT中EBU转Unicode妈

1,首先是下载下面的转码数组,将EBU编码转换为Unicode数字编码

  https://files.cnblogs.com/files/senior-engineer/EBU%E7%BC%96%E7%A0%81_European_Broadcasting_Union.rar

2,然后调用下面的数组将Unicode数字编码转换为Unicode字符串。

QString getEBUToUnicode(const char *data, const ushort length)
{
    ushort sName = 0;
    QString strName;
    for(int j = 0; j < length ; j++)
    {
        sName = ebuLatinToUcs2[data[j]];
        strName += QChar(sName);
    }
}

3,因为QT默认使用的是Unicode的编码,将对应字符串显示就可以了。

说明:验证显示的Unicode编码是否正确

    unsigned short strName[16] = {78,82,75,32,80,
                                  49,32,216,115,116,
                                  102,111,108,100,32,32};

将上面输出的数字转换为下面的格式

u004Eu0052u004Bu0020u0050u0031u0020u00D8u0073u0074u0066u006Fu006Cu0064u0020u0020

然后对应字符输入下面网站中,对照控件上面显示的字符和网站上面显示字符是否一致。注意不要通过打印验证,因为有些特殊字符打印是显示不出来的。

http://tool.chinaz.com/tools/unicode.aspx

原文地址:https://www.cnblogs.com/senior-engineer/p/13217511.html