c++;日文字符命令行输出 我在命令行(OSX)上用C++打印日语字符。< /P>
我很高兴看到任何字符正确地打印在我的命令行上,但我不明白我的问题是什么。没有打印任何内容,甚至没有错误字符,也没有出现任何错误。我的角色被吞没了。我做错了什么c++;日文字符命令行输出 我在命令行(OSX)上用C++打印日语字符。< /P>,c++,C++,我很高兴看到任何字符正确地打印在我的命令行上,但我不明白我的问题是什么。没有打印任何内容,甚至没有错误字符,也没有出现任何错误。我的角色被吞没了。我做错了什么 #include <string> #include <clocale> #include<iostream> int main(int argc, char** args){ std::setlocale(LC_ALL,""); wchar_t c=L'あ'; std::
#include <string>
#include <clocale>
#include<iostream>
int main(int argc, char** args){
std::setlocale(LC_ALL,"");
wchar_t c=L'あ';
std::wcout<<c;
std::wstring s = L"あ";
std::wcout<<s;
return 0;
}
#包括
#包括
#包括
int main(int argc,char**args){
std::setlocale(LC_ALL,“”);
wchar_t c=L'あ';
std::wcout您可能不需要该行:
std::setlocale(LC_ALL, "");
用于日期和时间格式之类的内容
相反,向输出流注入正确初始化的locale
对象
std::wcout.imbue(std::locale("ja_jp.utf-8"));