c - 为什么我的电脑不能用C语言的char数组显示假名?

标签 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;
}

代码在我的电脑上不显示假名「おおお」, 但我 friend 电脑上的相同代码显示假名。 我们都是 Windows 10 操作系统,并且使用相同的日语。 是不是我的电脑设置有问题?

enter image description here

and the printf is work good

最佳答案

这取决于您的编辑器(或浏览器,或您使用的任何东西)设置的“编码”。

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

关于c - 为什么我的电脑不能用C语言的char数组显示假名?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53023507/

相关文章:

c - K&R 递归下降解析器错误

c - 传递给共享对象函数的参数

c - 尝试分配不兼容的类型时出错

c++ - 将 C++ 从 Linux 移植到 Windows, '__aligned__'

windows - 安装 mpich2 时出错

c - strerror 描述字符串

python - 使用 Python 对 C 代码进行单元测试的最简单方法

windows - FFmpeg 编译与编码器 x264 未找到 Windows

windows - 自动网页截图

c++ - Exe 在 BackupRead Windows 函数中崩溃