I attempted to print braille characters in ncurses.
This is my code:
#include <ncurses.h>
char *str =
" ⠁⠂⠃⠄⠅⠆⠇⠈⠉⠊⠋⠌⠍⠎⠏\n"
"⠐⠑⠒⠓⠔⠕⠖⠗⠘⠙⠚⠛⠜⠝⠞⠟\n"
"⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯\n"
"⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿\n";
int main(int argc, const char *argv[]) {
initscr();
printw("%s", str);
getch();
printf("%s", curses_version());
endwin();
printf("%s", str);
return 0;
}
The output is:
?~A?~B?~C?~D?~E?~F?~G?~H?~I?~J?~K?~L?~M?~N?~O
?~P?~Q?~R?~S?~T?~U?~V?~W?~X?~Y?~Z?~[?~\?~]?~^?~_
⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯
⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿
How do I output all characters correctly?
Update: I also tried printf
which seems to work, addstr
produces the same output as printw
.
If I change the locale with setlocale(LC_ALL, "");
I get the output:
A B C D E F G H I J K L M N O
P Q R S T U V W X Y Z [ \ ] ^ _
⠠⠡⠢⠣⠤⠥⠦⠧⠨⠩⠪⠫⠬⠭⠮⠯
⠰⠱⠲⠳⠴⠵⠶⠷⠸⠹⠺⠻⠼⠽⠾⠿