Subject: bug#26396: 25.1; char-displayable-p on a latin1 tty

From: Paul Eggert <[email-masked]>
Date: Sun, 16 Apr 2017 22:56:08 -0700

Paul Eggert wrote:
> In that case I stand corrected: some people are stull using non-UTF-8 Linux
> consoles.

I installed the attached patch into master to try to work around the problem 
that prompted the original bug report. This patch assumes that the terminal 
coding system is compatible with the Linux console output mode (either UTF-8, or 
unibyte), which I hope is good enough, as anybody whose locale is incompatible 
with the output mode will have lots of other problems anyway. Please give the 
patch a try.
>From 746e0bb2fc148cdb96bdde75e810dd5ce446e3a4 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Sun, 16 Apr 2017 22:50:02 -0700
Subject: [PATCH] Work around bug with unibyte Linux consoles

* src/terminal.c (terminal_glyph_code): Skip the UTF-8 stuff if
the terminal's coding system is unibyte (Bug#26396).
---
 src/terminal.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/terminal.c b/src/terminal.c
index 0b1cbe7..3d25b36 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -575,7 +575,9 @@ Lisp_Object
 terminal_glyph_code (struct terminal *t, int ch)
 {
 #if HAVE_STRUCT_UNIPAIR_UNICODE
-  if (t->type == output_termcap)
+  /* Heuristically assume that a terminal supporting glyph codes is in
+     UTF-8 mode if and only if its coding system is multibyte (Bug#26396).  */
+  if (t->type == output_termcap && t->terminal_coding->src_multibyte)
     {
       /* As a hack, recompute the table when CH is the maximum
 	 character.  */
-- 
2.7.4