←back to thread

331 points willm | 3 comments | | HN request time: 0.417s | source
Show context
rivo ◴[] No.41216673[source]
It's funny how every TUI developer eventually stumbles over Unicode and then handling international characters and emojis correctly turns into its own project close to the same scope of (or even bigger than) the original TUI project. It happened to me on rivo/tview and through the resulting rivo/uniseg package, I learned that all other TUI library maintainers deal with the same issues. Finally, everyone invents their own unique solutions to the problem because character width is not standardized and terminals are messy, as noted in the article. OP simply supports Unicode 9 only (Unicode is at version 15.1 at the moment). Sooner or later, users will complain, however, that certain emojis or international characters are not rendered correctly. So I'm not sure that this is a great solution.
replies(2): >>41217049 #>>41218008 #
rockorager ◴[] No.41218008[source]
The state of the art here is to detect mode 2027, and enable it when supported. This lets you know the terminal will handle graphemes properly.

I maintain two TUI libraries which use this technique and emoji support has been (nearly) great. (One of which uses your uniseg library!)

https://mitchellh.com/writing/grapheme-clusters-in-terminals

replies(3): >>41218432 #>>41220186 #>>41220385 #
1. sweeter ◴[] No.41218432[source]
really great read, thanks. Im a little disappointed that no terminal emulator both implements the Kitty image protocol, and mode 2027. I wish there would be a terminal project that would just pick the best standards we have at the moment. Im not a fan of sixel for a lot of reasons. Im looking forward to trying Ghostty, though.
replies(2): >>41218556 #>>41219418 #
2. rockorager ◴[] No.41218556[source]
Ghostty has both mode 2027 and kitty image protocol
3. eNV25 ◴[] No.41219418[source]
wezterm has both according to the above article