You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying entering some characters, for example U+1F603, U+1F60A or U+1F612 either by keyboard (compose sequences) or copy-paste does not show the character (entering one between quotes does work though, still with some glitches).
Some breakdown. First of all, for first and second examples some trailing white space was entered. For every character entered after the smile, quote before the smile is duplicated, but interestingly enough – echo is not. In the last example, smile does not appear at all (but was inserted at the beginning). Entering text after it is possible, but deleting does not respond with expected feedback (characters from internal buffer are cleared as far as I observed).
sh and bash obviously work fine in same terminal emulator.
I suspect the unicode library fish uses (does fish use one?) – it might not support any unicode characters outside BMP and SMP planes.
Interesting, considering fish supports SMP perfectly fine.
glitchmr@pineapple ~> echo 𝌠
𝌠
In fact, 😃 itself belongs to SMP. It's near the SMP end, but still in SMP.
From interest, I have decided to check zsh syntax highlighting (yes, it also has syntax highlighting, as a plugin - it's worse than syntax highlighting in fish, but it's usable).
Huh? Why zsh hasn't even tried to render 😃? Hmmm... 𝌠 is Unicode 4.0, and 😃 is Unicode 6.0. Could it be that wcwidth() doesn't recognize Unicode 6.0.
Perhaps fish could be changed to not even try to render unknown characters, just like zsh does (wcwidth should return -1 in that case). It works in dumb shells, like bash, but fish actually does complex math on characters, and needs to know their width. Certain characters, like fullwidth characters need more than one character to be written correctly.
Indeed, it seems that fish never checks the return value of wcwidth, and as the result, it removes 1 character, causing craziness. I think that fish instead should print <0001f603> or something instead. Or assume the length is 1, but that sounds dangerous.
It's gnome-terminal, so should be reproducible in any terminal based on VTE. There's lot of those in linux world. If you can't reproduce it in any terminal emulators not using VTE, it might be an issue with VTE though.
@ridiculousfish does also happen on KDE's Konsole terminal, which is not based on VTE.
I've been trying to write echo 🍅 and the tomato character does not show up, even though running the command gives the expected output. Also, next time I write 'echo' and I'm autosuggested the above command, the whole line gets garbled until I remove it from the history.
Can reproduce on VTE-based Terminator and non-VTE Konsole terminal emulators. Bash is not affected.
I tested with 2.2.0.r55.g97edc96 (i.e. before 2217) and 2.2.0.r70.gdd4639e (after 2217), and I don't get a meaningful change. (Unfortunately I can't create a screenshot because of a bug in my screenshotting utility, will try to track that down)
I cannot reproduce this using a fish built from git head as of this comment. There have been a ton of changes related to how locales and unicode are handled since this issue was opened. Or even since the last update 11 months ago. It seems reasonable to conclude it has been fixed so I'm closing it. If someone can still reproduce using a fish built from current source feel free to reopen.
@z3ntu: This works for me, also with Konsole, also on Arch. What's your locale? Does this happen without history (try sh -c 'env HOME=$(mktemp -d) fish')?
$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=en_DE.UTF-8
LC_TIME=en_DE.UTF-8
LC_COLLATE=C
LC_MONETARY=en_DE.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_DE.UTF-8
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
Yes, I know, that en_DE.UTF-8 is neither a valid X11 locale nor does it actually exist somehow on my system. But I want to have my system on English and my formats in German and that's why KDE sets my locale to this weird frankenstein monster of a locale.
Yes, I know, that en_DE.UTF-8 is neither a valid X11 locale nor does it actually exist somehow on my system. But I want to have my system on English and my formats in German and that's why KDE sets my locale to this weird frankenstein monster of a locale.
That's the issue. When I set any locale variable to "en_DE.UTF-8", it starts failing. I'm guessing fish's setup here fails without an error. @krader1961: Can you confirm?
While I can only suggest, @z3ntu, that you set your locale variables to something sensible, as far as I can see we should still be able to read and echo characters properly as long as LC_CTYPE (or if that is unset LANG or LC_ALL) is set properly.
Isn't it set correctly? Btw do you know how you can fix these en_DE things but retain the german formats in KDE? EDIT: Same behaviour on my server with the following locale settings:
You cannot set any of the locale env vars to invalid values. Doing so causes the libc locale subsystem to fallback to a single-byte locale. That in turn causes fish to incorrectly calculate how many columns (cells) are taken up on the terminal by those wide characters. Since your terminal is still decoding the UTF-8 sequences into wide characters but fish is no longer doing so you see the behavior you observed.
This is really obvious on BSD systems. I cut and pasted your locale vars into a script, exported them, then started a new fish instance. Within that instance I ran the locale command. Here is what it output:
On Ubuntu (and presumably all GNU Linux systems) the output of locale obscures the problem:
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_US.UTF-8
LANGUAGE=en_US:
LC_CTYPE=en_US.UTF-8
LC_NUMERIC=en_DE.UTF-8
LC_TIME=en_DE.UTF-8
LC_COLLATE=C
LC_MONETARY=en_DE.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_DE.UTF-8
LC_IDENTIFICATION=en_US.UTF-8
LC_ALL=
However, notice the first line of output. That's essentially telling you that you can't expect sane behavior given your combination of locale vars. On both systems fish treats each byte of those multibyte UTF-8 sequences as an individual character because that's what the libc locale subsystem is doing.
I can't explain why KDE isn't exhibiting weird behavior. Perhaps it's using a different locale API than the one in libc.
P.S., In the future please use asciinema rather than youtube videos.
This is how my KDE "Formats" settings window looks... I really don't know why it does this weird stuff... EDIT: Finally fixed it. Whatever the format nds_DE should be, uncommenting this in the /etc/locale.gen file and running locale-gen fixed it. Thanks for the help!
Another EDIT: I finally found a non "Low German" (weird language ^^) setting for Austria. I actually only found these weird ones, as I was searching for "German" (as my system is english) but it is called "Deutsch" and "Österreich"... So again thanks.
Activity
sugar700 commentedon May 16, 2013
Interesting, considering fish supports SMP perfectly fine.
In fact, 😃 itself belongs to SMP. It's near the SMP end, but still in SMP.
From interest, I have decided to check zsh syntax highlighting (yes, it also has syntax highlighting, as a plugin - it's worse than syntax highlighting in fish, but it's usable).
Huh? Why zsh hasn't even tried to render 😃? Hmmm... 𝌠 is Unicode 4.0, and 😃 is Unicode 6.0. Could it be that
wcwidth()doesn't recognize Unicode 6.0.Perhaps fish could be changed to not even try to render unknown characters, just like zsh does (
wcwidthshould return-1in that case). It works in dumb shells, like bash, but fish actually does complex math on characters, and needs to know their width. Certain characters, like fullwidth characters need more than one character to be written correctly.Indeed, it seems that fish never checks the return value of
wcwidth, and as the result, it removes 1 character, causing craziness. I think that fish instead should print<0001f603>or something instead. Or assume the length is 1, but that sounds dangerous.ridiculousfish commentedon Jun 9, 2013
@nagisa , which terminal emulator are you using? I can't reproduce in Apple's Terminal app, though iTerm has lots of issues
nagisa commentedon Jun 9, 2013
It's gnome-terminal, so should be reproducible in any terminal based on VTE. There's lot of those in linux world. If you can't reproduce it in any terminal emulators not using VTE, it might be an issue with VTE though.
1player commentedon May 7, 2015
@ridiculousfish does also happen on KDE's Konsole terminal, which is not based on VTE.
I've been trying to write
echo 🍅and the tomato character does not show up, even though running the command gives the expected output. Also, next time I write 'echo' and I'm autosuggested the above command, the whole line gets garbled until I remove it from the history.Can reproduce on VTE-based Terminator and non-VTE Konsole terminal emulators. Bash is not affected.
Ninja3047 commentedon Jul 20, 2015
+1 for this issue, I have tried on both st and urxvt so it's definitely a fish issue.
zanchey commentedon Jul 20, 2015
This might be better since #2217 got merged; have you had a chance to try on a version newer than 2.2.0-65-ge7273e1 (i.e. built from master)?
faho commentedon Jul 20, 2015
I tested with 2.2.0.r55.g97edc96 (i.e. before 2217) and 2.2.0.r70.gdd4639e (after 2217), and I don't get a meaningful change. (Unfortunately I can't create a screenshot because of a bug in my screenshotting utility, will try to track that down)
zanchey commentedon Sep 29, 2015
http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/ is good reading.
wcwidthmay be to blame here.krader1961 commentedon Jun 19, 2016
I cannot reproduce this using a fish built from git head as of this comment. There have been a ton of changes related to how locales and unicode are handled since this issue was opened. Or even since the last update 11 months ago. It seems reasonable to conclude it has been fixed so I'm closing it. If someone can still reproduce using a fish built from current source feel free to reopen.
z3ntu commentedon Jul 20, 2016
@krader1961 I don't know if this is the exact same problem, but the newest git version still doesn't work with the characters üöä as expected. Video demonstration is here: https://youtu.be/vxAy0isw9Qc
I am using Konsole with the
fish-gitAUR (Arch Linux) package which I just compiled.faho commentedon Jul 20, 2016
@z3ntu: This works for me, also with Konsole, also on Arch. What's your locale? Does this happen without history (try
sh -c 'env HOME=$(mktemp -d) fish')?z3ntu commentedon Jul 20, 2016
Yes, same behaviour without history.
Yes, I know, that
en_DE.UTF-8is neither a valid X11 locale nor does it actually exist somehow on my system. But I want to have my system on English and my formats in German and that's why KDE sets my locale to this weird frankenstein monster of a locale.faho commentedon Jul 20, 2016
That's the issue. When I set any locale variable to "en_DE.UTF-8", it starts failing. I'm guessing fish's setup here fails without an error. @krader1961: Can you confirm?
While I can only suggest, @z3ntu, that you set your locale variables to something sensible, as far as I can see we should still be able to read and echo characters properly as long as LC_CTYPE (or if that is unset LANG or LC_ALL) is set properly.
z3ntu commentedon Jul 20, 2016
Isn't it set correctly? Btw do you know how you can fix these en_DE things but retain the german formats in KDE?
EDIT: Same behaviour on my server with the following locale settings:
krader1961 commentedon Jul 20, 2016
You cannot set any of the locale env vars to invalid values. Doing so causes the libc locale subsystem to fallback to a single-byte locale. That in turn causes fish to incorrectly calculate how many columns (cells) are taken up on the terminal by those wide characters. Since your terminal is still decoding the UTF-8 sequences into wide characters but fish is no longer doing so you see the behavior you observed.
This is really obvious on BSD systems. I cut and pasted your locale vars into a script, exported them, then started a new fish instance. Within that instance I ran the locale command. Here is what it output:
On Ubuntu (and presumably all GNU Linux systems) the output of
localeobscures the problem:However, notice the first line of output. That's essentially telling you that you can't expect sane behavior given your combination of locale vars. On both systems fish treats each byte of those multibyte UTF-8 sequences as an individual character because that's what the libc locale subsystem is doing.
I can't explain why KDE isn't exhibiting weird behavior. Perhaps it's using a different locale API than the one in libc.
P.S., In the future please use asciinema rather than youtube videos.
z3ntu commentedon Jul 21, 2016
This is how my KDE "Formats" settings window looks... I really don't know why it does this weird stuff...
EDIT: Finally fixed it.Whatever the formatnds_DEshould be, uncommenting this in the/etc/locale.genfile and runninglocale-genfixed it. Thanks for the help!Another EDIT: I finally found a non "Low German" (weird language ^^) setting for Austria. I actually only found these weird ones, as I was searching for "German" (as my system is english) but it is called "Deutsch" and "Österreich"... So again thanks.