Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Unicode ZWJ sequence



On 8/18/23, Alexandre ZANNI <alexandre@xxxxxxxxx> wrote:
> Hi,
>
> I'm new to this newsletter, I don't know if I'm reporting this issue
> correctly. All I found is this email address.
>
> TL;DR: zsh is not handling Unicode ZWJ (Zero Width Joiner) sequence.
>
> "👩‍❤️‍👨" (that will probably not render here) is a Unicode grapheme
> composed of multiple code points (U+1f469 U+200d U+2764 U+fe0f U+200d
> U+1f468). It's basically combining some emojis together to craft a more
> complex one. For that the Zero Width Joiner ‍(U+200D) and the Variation
> Selector-16 (U+FE0F) are used. But instead of displaying one grapheme, zsh
> is displaying each individual code point.
> As you can see below the terminal emulator named foot is capable of
> displaying such a grapheme, and other command line shell like bash or fish
> are capable of it too, only zsh can't.
>
> [1]
> Using zsh 5.9.
>
> Is this problem already known?

It's actually not possible to display these emojis in a terminal
correctly. There is no way for the program inside the terminal (zsh)
to know whether the rendering application will combine emojis with a
ZWJ between them, and thus has no idea what width they will take up.
This makes it impossible to predict where linebreaks will happen, etc,
leading to display corruption unless you happen to guess correctly.

-- 
Mikael Magnusson




Messages sorted by: Reverse Date, Date, Thread, Author