c++ - c++如何在没有 ICU(gcc/cl 编译器)之类的东西的情况下在没有 wchar 的情况下在 c++ 中使用 utf-8 和/或 utf-32?
问题描述
我尝试了很多东西,但它们似乎不起作用。
#include <iostream>
#include <locale>
using namespace std;
int main() {
setlocale(LC_ALL, "en-US.utf8");
std::string uni = u8"ユチエフー8";
std::cout << uni;
std::cin.get();
return 0;
}
请注意,我希望 utf-8/utf-32 不仅在这种情况下工作,而且在大多数情况下不使用宽字符之类的东西。
解决方案
推荐阅读
- amazon-cloudformation - 确定 AWS CDK 所需的权限
- angular - 为什么我在 2 个模块中注入服务是单例模式?
- javascript - 我有用于像素化预加载图片的 p5.js 代码。我正在尝试将图片分解为按钮的所有矩形
- firebase - firebase 可调用函数 (hello-wolrd-level) 已超过最后期限
- python - TypeError:预期的字符串或类似字节的对象 - Django
- python - 无法从python中的模块导入函数
- python - 为什么 pip list 不显示 sys.path 中所有目录的模块?
- regex - 以空格或斜杠开头的搜索字符串
- php - PHP 警告:array_merge():参数 #2 不是数组
- javascript - 使用 jQuery 将 ID 中的类与 ID 中的另一个类进行比较