So I'm having a problem with displaying the 'ã' character, which is an a with a tilde on it. Originally, I had an issue with displaying characters with any accents correctly, but I've found some code which renders almost all of them properly.
Here's what I've been using (and displays a regular 'a' for 'ã', but everything else correctly):
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
#include <io.h>
#include <fcntl.h>
#include<string>
usingnamespace std;
int main()
{
_setmode(_fileno(stdout),_O_U16TEXT);
// Thanks to: http://cplusplus.com/forum/general/48408/
string x = "inscrição";
wcout << x.c_str() << endl;
system("PAUSE");
}
I've also looked in the "fcntl.h" header file and seen what other substitutes I could use for _O_U16TEXT, and the others don't present the 'ã' character correctly either.
Is there something else I can do to have these displayed correctly?
check out this image i made... it has the int correspondent to every char you can show in console.
as you'd probably see, there is no 'ã'. so in short, you cannot display 'ã' in the c program.
check out this image i made... it has the int correspondent to every char you can show in console.
as you'd probably see, there is no 'ã'. so in short, you cannot display 'ã' in the c program.
No, there's no way to display 'ã' with the regular iostream library's available characters. I'm looking for workarounds to display this character correctly, because my target audience is Brazilian. You're basically saying that C++ is incompatible with a 300+ million person country. And since you said "in short", I'd like to know the long explanation (if there is one).
apologies if my answer was too short and uninformative. i only have knowledge in C, and i was taught about the 255 characters available in the console. i made use of the knowledge and programmed a program to display the image, as shown, and since the 256th character was the 1st character, and so on, it can be assumed that its a loop. so the console can only display 255 characters, to my knowledge.
its my mistake, i admit it as i didn't know about this. i made some research on this matter and found this link
and, quoting some explanation from Dave Van den Eynde
The C++ compiler does not support Unicode in code files. It's not going to produce the desired output in your console, because the console does not support Unicode.
i hope this helps :)
--
edit:
another person here suggested using powershell which allows unicode characters, but i am not sure how to use powershell.