I was just writing a C++] program that uses the box characters to display information. I ran the program on macOS and used the terminal app and it worked fine.
When I switched to Debian Linux using the same code and recompiling it, I only then encountered this problem! I've searched online for answers, but I have found none related to this problem. I've tested this with both LXTerminal and URXVT.
Here is my minimal reproducible example of this problem:
#include <ncurses.h>
#include <iostream>
int ch;
int main() {
setlocale(LC_CTYPE, "");
initscr();
noecho();
keypad(stdscr, true);
nodelay(stdscr, true);
curs_set(0);
start_color();
use_default_colors();
init_pair(1, COLOR_BLUE, -1);
clear();
refresh();
while ((ch = getch()) != 'q' && ch != 'Q') {
attrset(COLOR_PAIR(1));
mvprintw(0,0,"┏━┓");
mvprintw(1,0,"┗━┛");
}
refresh();
endwin();
return 0;
}
Compile this demo with this command below:
g++ -g -c -o main.o test.cpp && g++ -g -o test main.o -std=c++11 -Wall -pedantic -lncurses
or
LDLIBS=-lncurses make test
Instead of displaying
┏━┓
┗━┛
it displays this:
M-b~T~OM-b~T~AM-b~T~S
M-b~T~WM-b~T~AM-b~T~[
Actual screen images
Normal (desired) display on macOS:
Abnormal display on Linux:
echo $TERM
, that returnsxterm-256color
, right?echo $TERM
, it returnsxterm-256color
. I am using printw() to display the box so its direct output to the terminal.