Subject: bug#50865: 28.0.50; Emoji with emoji modifier in Linux console garbles emacs display

From: Eli Zaretskii <[email-masked]>
Date: Mon, 04 Oct 2021 19:35:23 +0300

> Date: Mon, 04 Oct 2021 16:15:45 +0300
> From: Eli Zaretskii <[email-masked]>
> Cc: [email-masked]
> 
> > From: Aura Kelloniemi <[email-masked]>
> > Cc: [email-masked]
> > Date: Mon, 04 Oct 2021 15:25:23 +0300
> > 
> > The solution of modifying char-width-table at least worked very well for me.
> > Of course I am intetrested in the things that will break, if I use it, but
> > most likely those will be smaller annoyances than a garbled display.
> > 
> > I can document this hack on emacs wiki, if nothing else can be done.
> 
> I don't recommend documenting such a "solution", because
> char-width-table affects more than just the display of wide
> characters, it also affects Lisp programs that use string-width and
> similar functions.

Here's a potentially better solution, which uses the display-table
feature built into Emacs to display problematic characters as some
other characters:

  (or standard-display-table
      (setq standard-display-table (make-display-table)))
  (aset standard-display-table
	#x1f64f (vector (make-glyph-code #xFFFD 'escape-glyph)))

This sets Emacs to display the U+01F64F PERSON WITH FOLDED HANDS
character as a diamond with a special face.  If the diamond also
causes trouble, try replacing it with some ASCII character, like '?'.

If this gives good results, you can do the same for any other
problematic character.  The disadvantage is that they all will look
the same on display, and the only way of knowing what is the real
codepoint in the buffer is to go to the character and type "C-u C-x =".