[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ACS_VLINE characters shifted in UTF-8 xterm

From: Sebastian Kayser
Subject: ACS_VLINE characters shifted in UTF-8 xterm
Date: Sun, 05 Apr 2009 13:35:49 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv: Gecko/20090302 Lightning/0.9 Thunderbird/ Mnenhy/


i have an ncurses-based application that draws a vertical line via
ACS_VLINEs to the screen. When i run this application in an UTF-8 xterm
(xterm-243) the ACS_VLINEs come out as a kind of a right-shifted
staircase. When i set NCURSES_NO_UTF8_ACS=1 or when i run the
application in dtterm the vertical line looks fine.

The application in question is mcabber [1], but i can recreate this
issue with a few lines of code [2]. It doesn't matter whether i link
against a regular ncurses or a --enable-widec one.

I have tried to wrap my head around this and read the relevant ncurses
FAQ items. From what i understand xterm is capable of interpreting the
ACS form characters just fine even in UTF-8 mode (so no need to set
NCURSES_NO_UTF8_ACS). I have truss'ed the application to see how the
vertical line gets written to the terminal.

  1B [ H     [ s t a t u s ]                          0E x0F1B [ m
  1B [ 1 B\b0E x0F1B [ m1B [ 1 B\b0E x0F1B [ m1B [ 1 B\b0E x0F1B [
   m1B [ 1 B\b0E x0F1B [ m1B [ 1 B\b0E x0F1B [ m1B [ 1 B\b0E x0F1B
   [ m1B [ 1 B\b0E x0F1B [ m1B [ 1 B\b0E x0F1B [ m1B [ 1 B\b0E x0F
  1B [ m1B [ 1 B\b0E x0F1B [ m1B [ 1 B\b0E x0F1B [ m1B [ 1 B\b0E x

So it is basically a sequence of "smacs, x, rmacs, sgr0, cud, \b"
sequences to draw the line. When i manually echo ACS_VLINE characters to
the terminal i can see that they consume two columns instead of one and
i suppose that's why the \b isn't sufficient to move completely backwards.

$ echo -e 'X(B X)0 \x0e x x x \x0f' | tr -d ' ' | tr 'X' '\033'

Pasting those vertical lines into od tells me that they are "BOX
DRAWINGS LIGHT VERTICAL". What exactly is responsible for printing them
instead of just "VERTICAL LINE" characters?

$ cat | od -tx1
0000000 e2 94 82 e2 94 82 e2 94 82 0a

Amending the sample application so that it writes a second vertical line
10 columns next to the first one (see the commented out line in the
sample code) makes ncurses only use CUP sequences for positioning and
the vertical lines look fine then (although i would assume that
character positioning after one such vertical line would still be shifted).

I am using Solaris 10 in case that matters, LC_CTYPE is set to
en_US.UTF-8. It seems as if a missing only a small part of the puzzle.
What's wrong with those vertical line characters and my UTF-8 xterm?


[1] http://www.lilotux.net/~mikael/mcabber/
[2] http://pastebin.com/m1878744a

reply via email to

[Prev in Thread] Current Thread [Next in Thread]