irc-core
irc-core copied to clipboard
Rewrite cleanText to strip zero width spaces characters
This is a fairly hack fix for the issue that I appear to be the only one suffering from. Certain non-ascii characters cause text to get corrupted in my terminal when using glirc - when connected
(macOS ->) (Alacritty|Terminal.app) -> Mosh -> tmux -> glirc.
All have been configured to understand and use utf-8 characters, but the zero width spaces that get included in the nicks from haskellbridge cause things get garbled. See screen shot and particularly note that the text immediately after nicks:
This problem is so bad that it affects other tmux windows when I switch between them. While other unicode characters like emojis cause problems, the prevalence of the zero width space (see https://www.unicode.org/charts/PDF/U2000.pdf - code 0x200B) is used in the haskellbridge matrix bot on Libera.chat, which causes glirc to be nearly unreadable for me when many matrix users are speaking.
I'm sure this isn't the best implementation of the fix, but I couldn't think of an appropriate character that '\8203' should be replaced with that wouldn't look strange. More than happy to implement alternatives, this is more for discussion that necessarily the final fix.
Another example from a channel with very little activity after switching from #ghc
It looks like the next release is making good progress, any chance this could be merged in too? I'm using it locally and haven't noticed any issues, and it fixes the bug shown above. Ping @glguy @TheDaemoness
This behavior might be Mosh's fault due to a disagreement between the Mosh client and server on the width of the, uh, zero-width space. See https://github.com/mobile-shell/mosh/issues/234#issuecomment-413336927. Does this still occur when you run glirc directly under Alacritty or Terminal.app on macOS?
Fixed by #125