hyper icon indicating copy to clipboard operation
hyper copied to clipboard

LANG and LC_CTYPE env variables cause many issues with unicode chars

Open lordgiotto opened this issue 10 years ago • 6 comments

Hyperterm sets LANG variable in app/session.js, but the way we are doing it creates some problems.

Since LC_CTYPE inherits from LANG variable, if the locale name returned by app.getLocale() is not an XPG syntax described by gnu.org here (LANGUAGE_TERRITORY.CHARSET) and it's not found in locales list locale -a, shell will fail with some unicode special chars, causing issues like #183, #597, #441 and probably #589.

I also noticed that, if locale is not set correctly like described above, alt key is used as metakey, despite hterm 'alt-sends-what' is set to 'browser-key' here.

A temporary workaround is to manually set the right locale for you in your .bashrc/.zshrc: for me it's export LANG=it_IT.UTF-8.

Hope it helps 😄

lordgiotto avatar Aug 11 '16 00:08 lordgiotto

The workaround solves my issue #589. I have set the LANG variable to de_DE.UTF-8 in my fish config (was de.UTF-8) and it helped.

hoffi avatar Aug 11 '16 11:08 hoffi

A temporary workaround is to manually set the right locale for you in your .bashrc/.zshrc: for me it's export LANG=it_IT.UTF-8.

Not fully worked for me with locale ru_RU. Hyper version 0.8.3.

I checked the locale:

$ locale
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: ?????????? ?????????? LC_ALL ? ?????? ?? ?????????.: ??? ?????? ????? ??? ????????
LANG=ru_RU.UTF-8
LANGUAGE=ru_RU
LC_CTYPE=ru.UTF-8
LC_NUMERIC="ru_RU.UTF-8"
LC_TIME="ru_RU.UTF-8"
LC_COLLATE="ru_RU.UTF-8"
LC_MONETARY="ru_RU.UTF-8"
LC_MESSAGES="ru_RU.UTF-8"
LC_PAPER="ru_RU.UTF-8"
LC_NAME="ru_RU.UTF-8"
LC_ADDRESS="ru_RU.UTF-8"
LC_TELEPHONE="ru_RU.UTF-8"
LC_MEASUREMENT="ru_RU.UTF-8"
LC_IDENTIFICATION="ru_RU.UTF-8"
LC_ALL=

I saw that the variable LC_CTYPE is set incorrectly.

So for me, a working version was like this:

export LANG=ru_RU.UTF-8
export LC_CTYPE=ru_RU.UTF-8

Put this to your .bashrc or .zshrc, replacing to your locale instead of ru_RU.

Arttse avatar Oct 27 '16 17:10 Arttse

Works for me as well had locale errors when using ssh client

dunst0 avatar Jan 25 '17 18:01 dunst0

Hi guys, I had the same issue, here's what I did to fix it (no é, è, à, ù, etc characters were well displayed) :

Made sure my library language was installed: sudo install language-pack-fr-base (for french) Then, allowed Ubuntu to automatically configure it: sudo dpkg-reconfigure locales Finally: export LC_ALL="fr_FR.utf-8"

Hope it helps!

ZeFifi avatar Oct 27 '17 12:10 ZeFifi

this also causes problems with ssh tab-completion.

onip avatar Dec 14 '17 15:12 onip

Hello, I'm facing this kind of problem on Windows environment with Powershell. Is there a workaround for this case (more information there : #2817) ?

sebastienschoepfer avatar Apr 10 '18 05:04 sebastienschoepfer