如何在c中打印utf-16字符

时间:2016-09-19 15:00:28

标签: c unicode utf-16

int main() 
{
    char c = 0x41;
    printf("char is : %c\n",c);

    c = 0xe9;
    printf("char is : %c\n",c);

    unsigned int d = 0x164e;
    printf("char is : %c\n",d);


    return 0;
}

我想要打印出来的是:

enter image description here

我在Windows上使用Ubuntu 64位VMware Workstation并使用Octal转储:

enter image description here

来自utf-16 LE txt文件的三个字符的十六进制值。

输出:

enter image description here

如何正确打印出utf-16字符?

0 个答案:

没有答案