Considering the following code:
#include <stdio.h>
#include <locale.h>
int main()
{
char test[100];
printf("WITHOUT LOCALE: á, é, í, ó, ú, ü, ñ, ¿, ¡\n");
setlocale(LC_CTYPE, "Spanish");
printf("WITH LOCALE: á, é, í, ó, ú, ü, ñ, ¿, ¡\n");
fgets(test, 100, stdin);
printf("WITH FGETS AND LOCALE: %s\n", test);
return 0;
}
And the following input for fgets:
á, é, í, ó, ú, ü, ñ, ¿, ¡
I'd expect it to support the special characters according to the locale that has been set up beforehand. However, this is the output:
WITHOUT LOCALE: ß, Ú, Ý, ¾, ·, ³, ±, ┐, í
WITH LOCALE: á, é, í, ó, ú, ü, ñ, ¿, ¡
WITH FGETS AND LOCALE: , ', ¡, ¢, £, ?, ¤, ¨,
Any idea about what could be happening?