使用Unicode C++的飞机符号
Airplane symbol using Unicode C++
我正试图在我的代码块中使用Unicode打印飞机符号。我发现飞机的代码是u2708
。所以我尝试了以下代码:
#include <iostream>
using namespace std;
int main() {
wchar_t a = 'u2708';
cout << a;
return 0;
}
当我用字符替换wchar_t时,它输出40072
char a = 'u2708';
我得到这个符号:ł
我真的很困,谢谢你的帮助。
如果您在Linux
中,并且不使用从unicode到控制台的代码页转换,请尝试以下操作:
std::locale::global(std::locale(""));
wchar_t plane = L'u2708';
std::wcout << plane << std::endl;
在windows中有点复杂,您需要在默认控制台上使用兼容的unicode字体和正确的代码页。
相关文章:
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 有符号的int和int-有没有一种方法可以在C++中区分它们
- 将无符号char*转换为std::istream*C++
- 如何在C++中将一个无符号的 int 转换为两个无符号的短裤?
- vscode g++链路故障:体系结构x86_64的未定义符号
- 从矢量<无符号字符>转换为字符* 包括垃圾数据
- 如何理解将半精度指针转换为无符号长指针和相关的内存对齐
- Visual studio代码重构似乎不起作用(例如,重命名符号-f2)
- 使用gcc从静态链接的文件中查找可选符号
- C++中无符号字符溢出
- 使用无符号字符数组有效存储内存
- C++:Application.cpp中抛出了未解析的外部符号(解决方案在问题的末尾,供未来的读者参考)
- VC++本机单元测试,找不到调试符号
- 为什么我必须在C++中添加一个赋值符号来声明一个数组
- 检查TCHAR数组输入是否为带符号整数C++
- 用符号版本替换对函数的所有调用
- 未解析的外部符号_MsiLocateComponentW@12.
- 如何打印boost多精度128位无符号整数
- C++模板函数,用于比较任何无符号整数和有符号整数
- 使用Unicode C++的飞机符号