0

I'm finding it impossible to programmatically produce an unbroken vertical line character (|) when working in a text-based terminal session. I've tried various Unicode characters - U+2502, U+007C, U+01C0, U+2223, U+2758 - to no avail. I thought it could be solved by changing the font used by the terminal program, but that was unsuccessful.

Here's the kicker ... ncurses can produce this character! Compare vert-by-curses and vert-by-java

My environment ... Mac OS X (El Capitan), iTerm2, Java 1.8 (build 1.8.0_111-b14)

So my question is this: how can I generate an unbroken vertical line (in text) from Java?

LiamF
  • 523
  • 3
  • 13
  • “… to no avail.” What happens when you print those characters? – VGR Nov 09 '16 at 14:24
  • I get a vertical bar, to be sure, but none are "full character cell height," i.e. one atop the other is visually broken. – LiamF Nov 09 '16 at 17:10
  • 1
    Sample pictures are unusable. Please copy&paste text from terminal window to show a [mcve]. Maybe there are different fonts? For instance, in Notepad++, vertical lines are continuous using `DejaVu Sans Mono` font but appear broken using `Courier New` font. Tested next pattern lines: `┌─────┐`,`│|│H│|│`,`├─────┤`,`│|│H│|│`,`└─────┘`. – JosefZ Nov 09 '16 at 19:11
  • FYI, Unicode CodePoint for `│` _Box Drawings Light Vertical_ is `U+2502`. Provided `(|)` example shows `U+007C` _Vertical Line_. Used both in previous comment to show the difference. – JosefZ Nov 09 '16 at 19:37
  • Your images would be more useful if they contained the same text. As they are, I’m having trouble discerning if they are using the same font. – VGR Nov 09 '16 at 20:13
  • I updated the images. I don't understand how it can be a font issue. In order for curses - or Java, for that fact - to change my terminal session's font, it would have to somehow communicate a font change to the terminal application, iTerm2 in this case. Regardless, I tried a whole series of fonts (in iTerm2's preferences). Nothing "breaks" curses' unbroken vertical line and nothing "joins" Java's broken vertical line. – LiamF Nov 10 '16 at 13:43
  • did you find what is needed to do in order these gaps disappear? There must be something to be send to the terminal (escape sequence or some configuration) in order this works properly but I can't find what. – Fis Mar 11 '20 at 00:12

1 Answers1

1

ncurses uses U+2502 for terminals which do not support VT100 line-graphics when using UTF-8 (see discussion of NCURSES_NO_UTF8_ACS). iTerm2 is not one of those.

Other terminals support the VT100 line-drawing with UTF-8, and (xterm for instance) may draw the characters when the font does not provide them. When using VT100 line-drawing, the application switches to the alternate character set — and the terminal determines which character (or drawing) to use. You could send the escape sequence using Java, but there are those other terminals where results would be poor.

The ASCII vertical bar U+007C may give a usable line, may not (there are bug reports here and there mentioning failure to draw the full height, or complaints that the bar has a gap in it).

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105