我正在尝试在 C++ 中使用希伯来字符,在 mac 上使用 Clion。
char notification[140]={"א"}; //this is ALEF the first letter of Hebrew ABC.
for(int i=0; i < strlen(notification); i++) {
cout << (int)notification[i] << endl;
} //Here I want to see what is the ASCII code for this letter.
这个的输出是:
-41
-112
尽管只输入了 1 个字符。
cout << char(-41) << char(-112) << endl; // this one gives me the output of the letter ALEF
cout << char(-41) << char(-111) << endl; //gives the second letter of Hebrew ABC.
我不明白它是如何工作的,为什么有 2 个字符来表示 1 个希伯来字符?
最佳答案
您会看到“א”的 UTF8 代码。但显然你的终端不支持这个字符集或UTF8。 (-41,-112) = (0xd7, 0x90)
Look here for UTF8 hebrew characters
您需要了解如何配置终端以支持希伯来字符集和 UTF8。
关于c++ - C++ 中的希伯来字符 (cout<<char<<char;),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32445388/