c++ - C++ 中的希伯来字符 (cout<<char<<char;)

标签 c++ char hebrew

我正在尝试在 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。

maybe this can help

关于c++ - C++ 中的希伯来字符 (cout<<char<<char;),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32445388/

相关文章:

c++ - 如何使 vim 标签跳转与 OmniCppComplete 一样智能?

c++:如何从UTF-8代码点创建unsigned char

将 c 十六进制值转换为 char*

asp.net-identity - 在 asp.net C# 身份中创建用户不适用于希伯来语用户名

c# - 文件 ReadAllLines 将外语变成乱码 (�)

c++ - 解析数据,scanf?

c++ - 确定最佳转换的 Variadic 模板

java - 如何为字母字符制作一个与字母顺序不同的比较器

读取 UTF-8 文本文件(希伯来语)在 RStudio 控制台中显示乱码,在 RGUI 中显示正常

c++ - 如何打印unicode代码点?