bug-ncurses
[Top][All Lists]
Advanced

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

Ncurses, UTF-8, Centos and box characters


From: Paul D Smith
Subject: Ncurses, UTF-8, Centos and box characters
Date: Thu, 12 Feb 2015 13:25:27 -0000

Dear Ncurses gurus,
 
Am I misunderstanding ncurses or is there a fundamental flaw in box character handling?  Perhaps you could read on and comment?
 
What I am finding is that I do not seem to be able to write an ncurses based program that can simultaneously handle UTF-8 based boxes and old (vt100) style boxes.  In order to get box characters on a UTF-8 system I have to:
 
  • link with ncursesw (seems reasonably)
  • call wborder() and not box() or border() (seems unreasonable)
  • specify characters such as WACS_VHLINE and not ACS_VHLINE.
This all seems very contrary to the concept of original curses which (and I last used curses 25 years ago!) was to be able to write, compile and run a single program that would run on any terminal type for which a TERMCAPS entry was possible.  So it didn’t matter whether I was using a vt100, vt220, tektronix or Wyse terminal, the same program ‘just ran’ and did the best it could to look pretty.
 
I was expecting UTF-8 support to act in a similar manner with a single program now adding UTF-8 as effectively a variant of whatever terminal type I might have and, more importantly, I should have minimal understanding of ‘'UTF-8/not-ness in my program throughout the development process.
 
What I was expecting was that:
 
  • If I link with ncurses, I get no UTF-8 support (why bother?!)
  • If I link with ncursesw I get UTF-8 support (surely you would always...)
  • If the locale support indicates UTF-8 then under the covers
    • ACS_VHLINE is mapped to WACS_VHLINE (and there is in fact no need for the WACS_ macros)
    • All functions such as box() are mapped to wbox() and similar (which are only internal functions)
  • There are no wborder() or similar functions because border() is mapped to old (7-bit) or wide functions under the cover based on locale
  • Possibly a belt-n-braces option that can be set (environment variable and/or something that can be passed in via a command line argument to the parent program) to force UTF-8 support on/off.
So, is ncurses UTF-8 support really the mess I think it is, or what did I miss?
 
Thanks,
Paul D.Smith.

reply via email to

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