关于eclipse输出汉字出现乱码的有关问题
关于eclipse输出汉字出现乱码的问题#includeiostream#includelocaleusing namespace stdint main(){s
关于eclipse输出汉字出现乱码的问题
#include<iostream>
#include<locale>
using namespace std;
int main()
{
setlocale(LC_ALL,"chs");
wchar_t wt[]=L"方";
wcout<<wt;
return 0;
}
上面程序编译完运行之后结果为:乱码(特殊字符不让显示)
我也百度过,这就是设置windows-preference-general-workplace-text file encoding改为UTF-8后的结果,
不改之前(GBK)的错误信息是(错误:converting to execution character set:Illegal byte sequence)
请大神们帮忙解决这个问题?! Eclipse C++ 编码 乱码 宽字符
[解决办法]把文件直接转为utf-8格式的吧
[解决办法]#include<iostream>
#include<locale>
using namespace std;
int main()
{
wchar_t wt[]=L"方";
wcout.imbue(locale("chs"));
wcout<<wt;
return 0;
}
[解决办法]我也遇到过。编译前把文件转成UTF-8后,就不会出现了。
觉得烦,后来直接打印英文。
[解决办法]2楼貌似是对的。。要通过imbue设置的
[解决办法]gcc没有实现chs locale, 试试vc++