I am trying to learn ncurses to add some functionality to my programs however I cannot seem to get my terminal settings to the point where the default ncurses window border shows up as expected.
Here is the output I am getting for a window with a box border:
lqqqqqqqqk
x x
x x
x x
mqqqqqqqqj
However I should be getting this:
┌────────┐
│ │
│ │
│ │
└────────┘
The only thing I am able to find that fixes this issue is setting my PuTTY Remove Character Set to be Latin-1 instead of UTF-8, however this messes up all of my other applications including VIM.
There were some related SO questions that I found (1 and 2) however neither of their solutions help me. The only interesting thing I pulled out of the second one is that if I run printf '\342\224\224\342\224\200\342\224\220'
in my command line it prints out └─┐
(which is correct...).
Here is the simple program I am using to test this:
#include <iostream>
#include <ncurses.h>
#include <string>
#include <cstring>
int main() {
WINDOW *my_win;
int startx, starty, width, height;
int ch;
initscr();
cbreak();
keypad(stdscr, TRUE);
refresh();
int height = 5;
int width = 10;
my_win = newwin(height, width, 1, 2);
box(my_win, 0, 0);
wrefresh(my_win);
getch();
endwin();
return 0;
}
Any ideas what I could be doing wrong? Thanks!
You're not initializing the locale. Without that, ncurses will assume that it can use the terminal description.
Further reading:
NCURSES_NO_UTF8_ACS
: