Skip to content

Unicode problem #1057

Closed
Closed

Description

@oblitum
~ uname -sp && tmux -V && echo $TERM
Linux unknown
tmux master
xterm-termite
  • System is ArchLinux.

Test run with:

  • tmux -Ltest kill-server
  • tmux -vv -Ltest -f/dev/null new
  • vim ./emojis

Logs and test file used:

Results:

overflow

Issue:

The overflow on column 80 doesn't happen for vim outside tmux. This issue pervades all console applications.

Activity

  1. oblitum commented on Sep 7, 2017

    @oblitum
    Author

    It's specially problematic with terminal IM applications, like weechat for example. Too many emojis == broken UI.

  2. nicm commented on Sep 7, 2017

    @nicm
    Member

    This is a most likely a problem with your system locale implementation. It is telling tmux these codepoints are width 1:

    1504743323.298691 input_utf8_close 4 '\360\237\244\227' (width 1)
    1504743323.298807 input_utf8_close 4 '\360\237\214\237' (width 1)

    But in fact they should be width 2.

    You can try building tmux against libutf8proc, or see if there is a later version of your libc, or see if you can find a font and terminal where the width of these symbols agrees with libc.

  3. oblitum commented on Sep 7, 2017

    @oblitum
    Author

    Hi, I didn't understand how my locale implementation is the issue, for what it's worth I use:

    LANG=en_US.utf8
    LC_CTYPE=en_US.UTF-8
    LC_NUMERIC=en_US.UTF-8
    LC_TIME=en_US.UTF-8
    LC_COLLATE=C
    LC_MONETARY=en_US.UTF-8
    LC_MESSAGES=en_US.UTF-8
    LC_PAPER=en_US.UTF-8
    LC_NAME=en_US.UTF-8
    LC_ADDRESS=en_US.UTF-8
    LC_TELEPHONE=en_US.UTF-8
    LC_MEASUREMENT=en_US.UTF-8
    LC_IDENTIFICATION=en_US.UTF-8
    LC_ALL=
    

    But you say the implementation, you mean, ArchLinux is broken? I have this issue for quite a long time I can't remember if it was since day one I started with tmux. If I have to apply patches, it's probable that they are needed in the official distribution packages. Replacing libc doesn't sound as a good idea, because it would affect the system entirely. Replacing terminal/font sounds a bit ad-hoc, I was a user of xfce4-terminal before termite and the problem was the same. So it seems the best option left is to try a tmux build against libutf8proc. I don't know exactly how to do it so I'll have a look. I still wonder, if it's an issue with system's locale implementation, why only tmux is affected? Because all terminal applications run outside tmux work fine.

  4. oblitum commented on Sep 7, 2017

    @oblitum
    Author

    Sadly, building with --enable-utf8proc made things worse. The former problem didn't get solved, and typing in the command line is now completely unpredictable. Example, my prompt is like:

    ~/Desktop ❯❯❯  |
    

    Where | is cursor position, and it's now quite far from ❯❯❯.
    I then type something:

    ~/Desktop ❯❯❯  ls|
    

    And force tab completion:

    ~/Desktop ❯❯❯ ls |
    

    The text gets moved back one char but the cursor is left in the same position, with one additional space before it. Now if I press backspace all the way trying to erase the text, I can't, it erases solely up to:

    ~/Desktop ❯❯❯ l|
    

    I can't erase the first char, it's left there visually only, because internally it was. Pressing enter doesn't result in a non-existing command l. This is just one case, as a whole it's quite unpredictable now.

  5. nicm commented on Sep 7, 2017

    @nicm
    Member

    Did you entirely do "make clean" before rebuilding with utf8proc?

    Probably these codepoints changed width in one of the newer Unicode versions.

    Latest utf8proc is Unicode 9.0; glibc 2.23 is Unicode 8.0 and 2.24/2.25 is Unicode 9.0; glib (used by VTE) is Unicode 10.0 as of 2.53.4 and 9.0 as of 2.50.1 and 8.0 as of 2.47.1.

    Anyway you need libc/utf8proc and terminal/font to be on the same version or you will have problems with symbols where the width disagrees.

    Or it could just be a bug or disagreement in one of the other.

  6. oblitum commented on Sep 7, 2017

    @oblitum
    Author

    I've installed the package from AUR from scratch. I'll try the former test with more fundamental large unicode characters that didn't change width between unicode versions.

  7. oblitum commented on Sep 7, 2017

    @oblitum
    Author

    The only thing not worth is trying with utf8proc I think.... I'll try with it again, with a different terminal prompt, because my unicode one may be interfering.

  8. nicm commented on Sep 7, 2017

    @nicm
    Member

    Try something like ハ (printf "\343\203\217") which is width 2 on all the platforms I have here.

  9. oblitum commented on Sep 7, 2017

    @oblitum
    Author

    OK, the problem doesn't show up with:

    |       |
    |  ハ☺  |
    |       |
    

    So, according with your Unicode version listing, this is quite a mess to try to solve. No idea whether I'll figure it out. Thanks for the help.

  10. oblitum commented on Sep 7, 2017

    @oblitum
    Author

    cc #836 as it's related.

  11. oblitum commented on Sep 8, 2017

    @oblitum
    Author

    @micm can you tell me which emoji font you use that displays 🤗🌟 in vim under tmux correctly (without ther overload issue)? I've changed to emojione and it had no effect.

    My settings where this test always produce the same issue:

    • glibc 2.25 -> Unicode 9.0
    • glib 2.52 -> Unicode 9.0
    • With or without --enable-utf8proc

    Only difference is that my prompt containing ❯❯❯ gets messy when --enable-utf8proc is passed. If I remove ❯❯❯ it gets back to normal, so with --enable-utf8proc these characters cause some issue. I've tried them with two fonts (Monoid and monofur for Powerline) but it didn't matter.

  12. oblitum commented on Sep 8, 2017

    @oblitum
    Author

    by the way, these version numbers correspond to the current state of ArchLinux.

  13. reopened this on Sep 8, 2017
  14. nicm commented on Sep 8, 2017

    @nicm
    Member

    I don't have a font that shows the symbols, my font just shows them as boxes that cover two normal size characters. But on Ubuntu with glibc 2.24, tmux is correctly told that these are width 2. If I build with utf8proc (I have 2.0.2) they are also width 2:

    1504853923.543282 input_utf8_close 4 '\360\237\244\227' (width 2)
    

    You can check by doing:

    rm tmux*.log
    tmux -Ltest -vv new
    printf '\360\237\244\227'
    exit
    grep input_utf8_close tmux-server-*.log
    

    Make sure your log shows this is width 2 and see if you still have problems.

  15. 75 remaining items

  16. nicm commented on Sep 8, 2017

    @nicm
    Member

    I don't know if those symbols are changed in 9.0 or 10.0 and I don't know what version of Unicode glibc 2.25 actually is.

  17. oblitum commented on Sep 8, 2017

    @oblitum
    Author

    OK, at least they claim Unicode 9 on their NEWS file.

  18. oblitum commented on Sep 8, 2017

    @oblitum
    Author

    Scratch that, I've confused glib NEWS with glibc NEWS, I don't know about the latter.

  19. oblitum commented on Sep 8, 2017

    @oblitum
    Author

    For what's worth, I checked their NEWS and there's no claim of full support for Unicode 9, they jump from 8 to 10.

  20. oblitum commented on Sep 8, 2017

    @oblitum
    Author

    Sorry to bother but I have another question I'd like to clear up. Just to fully diagnose the mutt use case and why it wraps like in that screenshot at the bottom.

    The stack without tmux is:

    • mutt calculates chars using glibc, the emojis are counted as width 1.
    • termite uses glib, for which the chars are width 2.

    It displays correctly but I don't know the explanation.

    The stack with tmux is:

    • mutt calculates chars using glibc, the emojis are counted as width 1.
    • original tmux from master using glibc receives the char stream from mutt and counts emojis as width 1 too.
    • termite uses glib, for which the chars are width 2.

    It displays incorrectly but I don't know the explanation.

  21. oblitum commented on Sep 9, 2017

    @oblitum
    Author

    I you wait for 6 months or a year everything will catch up and these symbols will work.

    @nicm I don't know whether it was b/c I asked about the update on #ArchLinux yesterday, but they upgraded yesterday, and... IT'S FIXED!

    I guess my last question doesn't matter anymore, except for sanity sake.

  22. oblitum commented on Sep 15, 2017

    @oblitum
    Author

    This escalated fast, now I have color emojis on termite without asking.

  23. tsujigiri commented on Oct 12, 2017

    @tsujigiri

    I had the same issue as in #1057 (comment), which disappeared when I installed libutf8proc 2 via libutf8proc-julia and rebuilt tmux (the current version in Arch Linux). I'm using fish (the shell) and my only remaining problem is that fish's right prompt still doesn't align with the right border of the shell, because apparently fish doesn't get the correct character widths either. But I can do without the right prompt for now. Thanks, @oblitum, for figuring this out! This already improved my quality of life significantly! #firstworldproblems

  24. an00bhav commented on Jan 17, 2018

    @an00bhav

    I am having the same problem with tmux built without/without libutf8proc on MacOS High Sierra. Does anyone knows a fix here?

  25. oblitum commented on Jan 17, 2018

    @oblitum
    Author

    @neo1691 the correct fix is to figure out how to get Unicode width calculation in sync with all the programs involved, for your platform. Since Sep 15, 2017 this is now working on ArchLinux because of that, glibc was upgraded to 2.26, supporting Unicode 10, and many programs rely on it (tmux, mutt, etc). Termite, which uses glib, not glibc, has compatible Unicode char widths, so nothing breaks.

  26. accessd commented on Apr 26, 2018

    @accessd

    @neo1691 If you are using iTerm try this solution gpakosz/.tmux#60 (comment)

  27. an00bhav commented on Apr 26, 2018

    @an00bhav
  28. an00bhav commented on May 29, 2018

    @an00bhav

    @accessd I finally got time to look into this after setting up everything again on a new Mac. Thanks a lot for linking the solution. The problem is solved, however there is one issue that still persists.

    When iterm is in window mode (not full screen), and you try to run a command that goes onto the next line, iterm makes it wrap onto the same line. Like the screenshot below:

    screenshot 2018-05-29 16 49 23

    Any idea what might be causing this?

  29. lock commented on Feb 15, 2020

    @lock

    This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  30. locked and limited conversation to collaborators on Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions