From 09021d9c0a4c748649dbc1c023d5eabc5c69f864 Mon Sep 17 00:00:00 2001 From: Markus Gans Date: Tue, 7 Feb 2017 17:15:01 +0100 Subject: [PATCH] Check of the termcap capability U8 --- ChangeLog | 4 ++++ src/fterm.cpp | 7 +++++++ src/ftermcap.h | 1 + 3 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index 0c1ce36a..f35201f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2017-02-07 Markus Gans + * Uses termcap capability U8 to identify terminals that can't display + vt100 line-drawing in UTF-8 mode + 2017-01-28 Markus Gans * Allow to change the focus out from FScrollView to another widget diff --git a/src/fterm.cpp b/src/fterm.cpp index b2b3c4c2..13899f46 100644 --- a/src/fterm.cpp +++ b/src/fterm.cpp @@ -95,6 +95,7 @@ bool FTermcap::automatic_right_margin = false; bool FTermcap::eat_nl_glitch = false; bool FTermcap::ansi_default_color = false; bool FTermcap::osc_support = false; +bool FTermcap::no_utf8_acs_chars = false; int FTermcap::max_color = 1; uInt FTermcap::tabstop = 8; uInt FTermcap::attr_without_color = 0; @@ -1298,6 +1299,9 @@ void FTerm::setEncoding (std::string enc) { std::map::const_iterator it; + if ( FTermcap::no_utf8_acs_chars && isUTF8() && enc == "VT100" ) + enc = "UTF8"; + // available encodings: "UTF8", "VT100", "PC" and "ASCII" it = encoding_set->find(enc); @@ -2619,6 +2623,9 @@ void FTerm::init_termcaps() // OSC = Esc + ']' FTermcap::osc_support = tgetflag(const_cast("XT")); + // U8 is nonzero for terminals with no VT100 line-drawing in UTF-8 mode + FTermcap::no_utf8_acs_chars = bool(tgetnum(const_cast("U8")) != 0); + if ( isTeraTerm() ) FTermcap::eat_nl_glitch = true; diff --git a/src/ftermcap.h b/src/ftermcap.h index 7aa0b562..02d9c919 100644 --- a/src/ftermcap.h +++ b/src/ftermcap.h @@ -56,6 +56,7 @@ class FTermcap static bool eat_nl_glitch; static bool ansi_default_color; static bool osc_support; + static bool no_utf8_acs_chars; static int max_color; static uInt tabstop; static uInt attr_without_color;