【发布时间】:2018-09-22 20:03:46
【问题描述】:
我正在尝试从 Windows 控制台打印和读取葡萄牙语字符,例如:ç、é 等等...
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
#include <wchar.h>
int main (void){
wchar_t stringtemp[5];
setlocale(LC_ALL,"Portuguese");
wprintf(L"test with portuguese character: ç\n");
wprintf(L"Insert a strange portuguese character: ");
wscanf(L"%s",stringtemp);
wprintf(L"%s\n",stringtemp);
return 0;
}
这是输出:
用葡萄牙语字符测试:ç
插入一个奇怪的葡萄牙语字符:ç
╬
有人知道那里出了什么问题吗?
【问题讨论】:
-
1我想inserirNovoRegisto部分不是很相关?请删除它。2minimal reproducible example 包含#include<stdio.h> #include<wchar.h> #include<locale.h>。 -
Unfortunately, cannot repro on TIO。可能是特定于 Windows 的。
-
@user202729 ,TIO 我的输出甚至最差......用葡萄牙语字符测试:?插入一个奇怪的葡萄牙语字符:>>
-
(我添加了
>>和<<以确保我不会错过任何内容) -
哪个操作系统?