How to print special characters like 'is' and 'ç' in windows console (printf)?
How to print special characters like 'is' and 'ç' in windows console (printf)?
There are three ways to use these special characters in windows:
Passing the code directly into printf: printf("isto \x82"); //imprime isto é
(This code above assumes CodePage 850)
Creating a function that uses the above functionality to print the special characters an example of the oprintf function that is available with the LGPL license
Or as Giovani said, using setlocale
.
Note: I suggest you do not use system ("PAUSE"); nor the library when there is no need. (They are in the setlocale example).
As you can find on the site: link
To solve this problem, you simply use the regionalization of C so that it not only accentuates the words correctly, but that shows dates and times in Portuguese, for example.
This is done using the setlocale command from the locale.h library. Follow an example code.
#include <stdio.h>
#include <conio.h>
#include <locale.h>
int main(void)
{
setlocale(LC_ALL, "Portuguese");
printf("Alô mundo! \n\n");
system("PAUSE");
return 0;
}
----- Edit --------
If you still have a problem, try changing the Command font: