为什么无法在计算机上以C语言显示假名by char数组?

时间:2018-10-27 15:34:30

标签: c windows

#include<stdio.h>
#include<string.h>
int  main()
{
    char test[100] = "おおお\n";
    int len = strlen(test);
    for (int i = 0; i < len; i++) {
        printf("%c", test[i]);
    }
    return 0;
}

该代码未在我的计算机上显示假名“おおお”, 但是我朋友计算机上的相同代码显示假名。 我们都是Windows 10操作系统,并且使用相同的日语。 我的计算机上设置有问题吗?

enter image description here

and the printf is work good

1 个答案:

答案 0 :(得分:1)

这取决于您的编辑器(或浏览器,或使用的是什么)设置为“编码”。

检查两台计算机上是否相同(可能是UTF-8,UTF-16,JIS等),请记住从C的角度来看,strlen("お")的结果不是1。