C ++中的希伯来字符(cout<< char<< char;) [英] Hebrew chars in C++ (cout<<char<<char;)

查看:123
本文介绍了C ++中的希伯来字符(cout<< char<< char;)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Mac上使用Clion在C ++中使用希伯来字符。

I'm trying to work with hebrew chars in C++ , using Clion on mac.

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

尽管有

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个希伯来字符?

I can't understand how it works why there is 2 chars to present 1 hebrew char ?

推荐答案

您会看到א的UTF8代码。但是您的终端显然不支持此字符集或UTF8。
(-41,-112)=(0xd7,0x90)

You see the UTF8 code for "א". but apparently your terminal not support this charset or UTF8. (-41,-112) = (0xd7, 0x90)

在此处查找UTF8希伯来语字符

您需要找到如何配置终端以支持希伯来字符集和UTF8。

You need to find how to configure the terminal to support Hebrew charset and UTF8.

也许这可以帮助

这篇关于C ++中的希伯来字符(cout&lt;&lt; char&lt;&lt; char;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆