You are not logged in.

#1 2020-07-23 09:51:06

Soptik
Member
Registered: 2019-03-11
Posts: 64

[Solved] Accent characters don't show up correctly in zsh

Hi,
when I try to write characters like this:

ěščřžýáíé

, they show up weirdly with visible ansi escape codes (see image). But when I echo them, they display correctly. It's broken only when I'm writing it in terminal (I tried alacritty, xterm and terminator) and when I'm using zsh (bash works fine). When I echo them, they display correctly. When I press <C-XE> to edit current line in vim, the characters display correctly.

The problem appeared after new install, I never encountered it on any machine, even though I use the same config everywhere. It doesn't matter which zsh config I use. Even when using no-config zsh or copying config directly from working machine, the issue still persists.

I tried completely purging and reinstalling Zsh. Even when I compile zsh from source, the issue still persists. I'm also encountering problems with autocomplete sometimes even without special characters, it looks like ansi escape code handling is somehow broken?

How does one debug this? Thanks

zsh broken accents

Last edited by Soptik (2020-07-24 07:33:38)

Offline

#2 2020-07-23 11:03:51

tucuxi
Member
From: Switzerland
Registered: 2020-03-08
Posts: 291

Re: [Solved] Accent characters don't show up correctly in zsh

Does the TERM environment variable have the same value in your zsh and bash session?

Offline

#3 2020-07-23 12:13:23

Soptik
Member
Registered: 2019-03-11
Posts: 64

Re: [Solved] Accent characters don't show up correctly in zsh

Yes, it does, `xterm-256color` (on alacritty which is my main terminal, eg it's `xterm` on xterm, but it is broken the same on all terminals).

Offline

#4 2020-07-23 12:33:22

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,692

Re: [Solved] Accent characters don't show up correctly in zsh

localectl
locale
locale -a
setxkbmap -print -query

Offline

#5 2020-07-23 21:08:46

Soptik
Member
Registered: 2019-03-11
Posts: 64

Re: [Solved] Accent characters don't show up correctly in zsh

root@lucy /home/petr # localectl
Could not get properties: Access denied


root@lucy /home/petr # locale                                                     
LANG=en_US.ISO-8859-1
LC_CTYPE="en_US.ISO-8859-1"
LC_NUMERIC="en_US.ISO-8859-1"
LC_TIME="en_US.ISO-8859-1"
LC_COLLATE="en_US.ISO-8859-1"
LC_MONETARY="en_US.ISO-8859-1"
LC_MESSAGES="en_US.ISO-8859-1"
LC_PAPER="en_US.ISO-8859-1"
LC_NAME="en_US.ISO-8859-1"
LC_ADDRESS="en_US.ISO-8859-1"
LC_TELEPHONE="en_US.ISO-8859-1"
LC_MEASUREMENT="en_US.ISO-8859-1"
LC_IDENTIFICATION="en_US.ISO-8859-1"
LC_ALL=


root@lucy /home/petr # locale -a
C
cs_CZ
cs_CZ.iso88592
cs_CZ.utf8
czech
en_US
en_US.iso88591
en_US.utf8
POSIX


root@lucy /home/petr # setxkbmap -print -query
xkb_keymap {
	xkb_keycodes  { include "evdev+aliases(qwerty)"	};
	xkb_types     { include "complete"	};
	xkb_compat    { include "complete"	};
	xkb_symbols   { include "pc+us+cz(qwerty):2+inet(evdev)+group(ctrls_toggle)+capslock(swapescape)+compose(lwin)"	};
	xkb_geometry  { include "pc(pc105)"	};
};
rules:      evdev
model:      pc105
layout:     us,cz
variant:    ,qwerty
options:    compose:lwin,caps:swapescape,grp:ctrls_toggle


root@lucy /home/petr # localectl list-locales
cs_CZ.UTF-8
en_US.UTF-8

Last edited by Soptik (2020-07-23 21:09:46)

Offline

#6 2020-07-23 21:37:25

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [Solved] Accent characters don't show up correctly in zsh

Do you have this problem only in a root terminal?
Why do you provide all that ouput as root?
It looks like you have the desired locale (CZ) but it isn't the default, currently used one?

Offline

#7 2020-07-23 22:14:50

Soptik
Member
Registered: 2019-03-11
Posts: 64

Re: [Solved] Accent characters don't show up correctly in zsh

No, the problem occurs everywhere. I used root terminal after I wasn't able to get output from `localectl` even with sudo. And the output is the same for localuser as well as for the root. But the issue is everywhere on every user account.

I think us locale should be the default, as I don't like mixing english and czech together.

Offline

#8 2020-07-24 06:14:49

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,692

Re: [Solved] Accent characters don't show up correctly in zsh

Your locale is clearly broken (and the cause for what you see)

Not as root:

stat /etc/locale.conf
cat /etc/locale.conf

Offline

#9 2020-07-24 07:33:20

Soptik
Member
Registered: 2019-03-11
Posts: 64

Re: [Solved] Accent characters don't show up correctly in zsh

Thank you,

setting locale to en_US.UTF-8 fixed this issue.

Offline

#10 2020-07-24 12:36:00

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [Solved] Accent characters don't show up correctly in zsh

^ Yes, any sort of ISO-8859-1 is probably discouraged nowadays.

Soptik wrote:

I wasn't able to get output from `localectl` even with sudo.

This is very strange, it works for me with or without sudo.

Offline

Board footer

Powered by FluxBB