I need to print part of the ASCII characters, namely:
char p = 219; // a rectangle printf("%c\n", p);
However, the shell does not display the correct character. What can I do to see the rectangle?
thank
You will need to use a virtual terminal that supports advanced ASCII. The default terminal in Ubuntu is gnome-terminal. You need to change the character encoding in the gnome terminal from UTF-8 to ISO-8859-2 or use a different terminal. Konsole , for example.
libiconv CP-1252 ISO-8859-1 8- , UTF-8; - :
#include <iconv.h> iconv_t cd = iconv_open("utf-8", "cp-1252"); iconv(cd, &inbuf, sizeof(inbuf), &outbuf, sizeof(outbuf)); // <- psuedocode, change to meet your needs
For me, the working code page is IBM850 . Using konsole , in the profile settings, advanced tab, you can select a code page. I can display extended ascii in this way (useful for accessing the IPMI BIOS).