You are not logged in.

#1 2019-06-04 13:31:06

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Can't type åäö into st or xterm

Hey everyone!

I have a problem where my terminal won't let me type åäö (and a bunch of other special characters like ¤ and £), but it can display them just fine if I echo the unicode character like

echo -e '\u00E5'

I have gotten them to work in urxvt if I set the imLocale option to en_US.utf8 or similar.


locale

outputs the following:

LANG=sv_SE.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC="en_US.utf8"
LC_TIME="en_US.utf8"
LC_COLLATE="en_US.utf8"
LC_MONETARY="en_US.utf8"
LC_MESSAGES="en_US.utf8"
LC_PAPER="en_US.utf8"
LC_NAME="en_US.utf8"
LC_ADDRESS="en_US.utf8"
LC_TELEPHONE="en_US.utf8"
LC_MEASUREMENT="en_US.utf8"
LC_IDENTIFICATION="en_US.utf8"
LC_ALL="en_US.utf8"

...which looks in order to me. I've tried setting everything to the UTF-8 version rather than utf8 as well, but no difference.

locale -a

outputs

C
en_US.utf8
POSIX
sv_SE.utf8

...which also looks fine to me.

My /etc/vconsole.conf only contains

KEYMAP=sv-latin1

which makes sense because åäö and whatnot works just fine in tty and all other applications that I've tried.

I'm currently running zsh with omzsh, but doing a chsh to bash gives the same result. I've looked through /etc/profile (which zsh sources) and some other files that looked like they could be responsible for what's going on (like /etc/profile.d/locale.sh and other shell profile files like .zshrc and whatnot)

Offline

#2 2019-06-04 13:51:31

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

Re: Can't type åäö into st or xterm

/etc/vconsole.conf is irrelevant for X11, see https://wiki.archlinux.org/index.php/Xo … figuration and certainly avoid OMZ while you're testing.

Offline

#3 2019-06-04 13:59:31

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

Thanks for the reply!

I just tried uninstalling omz and sourcing /etc/profile from .zshrc instead (to preserve the locale), but it doesn't seem to have helped. Output of locale and locale -a are the same as before.

I chose to include the vconsole.conf just to include as much info as possible as I've seen it asked for in other threads related to the same issues.

Offline

#4 2019-06-04 14:11:35

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

Re: Can't type åäö into st or xterm

OMZ is not the cause, you shall avoid it to not have it cause further obstacles until you're done with this one.
Did you read the linked wiki on how to configure your keyboard on X11?

Offline

#5 2019-06-04 14:26:02

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

My 00-keyboard.conf looks fine to me

Section "InputClass"
    Identifier "system-keyboard"
    MatchIsKeyboard "on"
    Option "XkbLayout" "se"
    Option "XkbModel" "pc105
EndSection

localectl outputs the following:

System Locale: LANG=sv_SE.utf8
LC_MESSAGES=en_US.utf8
VC Keymap: sv-latin1
X11 Layout: se
X11 Model: PC105

Offline

#6 2019-06-04 14:28:27

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

Re: Can't type åäö into st or xterm

What's the output of

setxkbmap -print -query
loginctl session-status

Offline

#7 2019-06-04 14:41:07

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

ivararch% setxkbmap -print -query
xkb_keymap {
        xkb_keycodes  { include "evdev+alia
        xkb_types     { include "complete"
        xkb_compat    { include "complete"
        xkb_symbols   { include "pc+se+inet
        xkb_geometry  { include "pc(pc105)"
};
rules:      evdev
model:      pc105
layout:     se
ivararch% loginctl session-status
1 - ivar (1000)
           Since: Tue 2019-06-04 16:37:10 C
          Leader: 421 (login)
            Seat: seat0; vc1
             TTY: tty1
         Service: login; type tty; class us
           State: active
            Unit: session-1.scope
                  ├─421 login -- ivar
                  ├─523 /bin/sh /usr/bin/st
                  ├─546 xinit /home/ivar/.x
                  ├─547 /usr/lib/Xorg -noli
                  ├─552 i3
                  ├─557 nm-applet
                  ├─611 polybar i3wmthemer_
                  ├─628 compton -b
                  ├─632 st
                  ├─633 /bin/zsh
                  ├─771 loginctl session-st
                  └─772 less

Again, thanks for the fast replies.

Last edited by PorousBoat (2019-06-04 14:41:33)

Offline

#8 2019-06-04 15:12:38

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

Re: Can't type åäö into st or xterm

That output is capped. It's not wayland and I don't see any advanced IM daemon, but one can also not see which layout variant is used (there're quite some in se…)
What is the actual output for those keys in the affected processes?
It should™ really not matter, but does it make a difference if you start uxterm instead of xterm?

Offline

#9 2019-06-04 15:21:36

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

The output for those keys as in what actually shows up in st/xterm when I press å or ö is either a '?' or <ffffffff>. In bash they always show as a ? symbol (not an actual '?', but a symbol of a '?' with a white background).

Jesus I didn't notice that it was capped. Talk about a rookie mistake! Here is the full output (apart from the firefox stuff, but that's irrelevant):

ivararch% loginctl session-status
1 - ivar (1000)
           Since: Tue 2019-06-04 16:37:10 CEST; 42min ago
          Leader: 421 (login)
            Seat: seat0; vc1
             TTY: tty1
         Service: login; type tty; class user
           State: active
            Unit: session-1.scope
                  ├─ 421 login -- ivar
                  ├─ 523 /bin/sh /usr/bin/startx
                  ├─ 546 xinit /home/ivar/.xinitrc -- /etc/X11/xinit/xserverrc :0 vt1 -keeptty -auth /tmp/serverauth.JLnklBhU5h
                  ├─ 547 /usr/lib/Xorg -nolisten tcp :0 vt1 -keeptty -auth /tmp/serverauth.JLnklBhU5h
                  ├─ 552 i3
                  ├─ 557 nm-applet
                  ├─ 611 polybar i3wmthemer_bar
                  ├─ 628 compton -b
                  ├─ 632 st
                  ├─ 633 /bin/zsh
                  ├─1102 /bin/zsh
                  ├─1107 telegram-desktop
                  ├─1288 /bin/sh /usr/bin/xdg-open https://bbs.archlinux.org/viewtopic.php?pid=1848668#p1848668
                  ├─1372 /usr/lib/firefox/firefox https://bbs.archlinux.org/viewtopic.php?pid=1848668#p1848668
                  ├─1430 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 183971 -parentBuildID >
                  ├─1471 /usr/lib/firefox/firefox -contentproc -childID 2 -isForBrowser -prefsLen 121 -prefMapSize 183971 -parentBuildI>
                  ├─1502 /usr/lib/firefox/firefox -contentproc -childID 3 -isForBrowser -prefsLen 5853 -prefMapSize 183971 -parentBuild>
                  ├─1591 /usr/lib/firefox/firefox -contentproc -childID 4 -isForBrowser -prefsLen 6585 -prefMapSize 183971 -parentBuild>
                  ├─1919 loginctl session-status
                  └─1920 less
lines 1-28/28 (END)

Last edited by PorousBoat (2019-06-04 15:22:00)

Offline

#10 2019-06-04 15:33:46

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

Re: Can't type åäö into st or xterm

either a '?' or <ffffffff>. In bash they always show as a ?

That actually indeed means xterm (and likely the same with st) is started out of a non utf-8 locale. Running "uxterm" instead does not cause this behavior?

How excatly is xterm started and what's the output of

tr '\0' '\n' < /proc/$$/environ
tr '\0' '\n' < /proc/$PPID/environ

Offline

#11 2019-06-04 15:43:50

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

I haven't really used xterm much at all - I just tried it to see if it was different in there. Like you said, the outputs should be the same for st. What I find strange is that the terminal (both of them) can display the characters just fine - It's the pressing of the button that causes issues.

St is being started through dmenu by just running st with no additional options.

Here are the requested outputs:

ivararch% tr '\0' '\n' < /proc/$$/environ
SHELL=/bin/zsh
XDG_SEAT=seat0
PWD=/home/ivar
LOGNAME=ivar
XDG_SESSION_TYPE=tty
XAUTHORITY=/home/ivar/.Xauthority
DESKTOP_STARTUP_ID=i3/i3-sensible-terminal/552-0-ivararch_TIME33792
WINDOWPATH=1
HOME=/home/ivar
INVOCATION_ID=b944c9fa12e74b15aedcc7822b200c70
XDG_SESSION_CLASS=user
TERM=st-256color
USER=ivar
DISPLAY=:0
SHLVL=1
XDG_VTNR=1
XDG_SESSION_ID=1
XDG_RUNTIME_DIR=/run/user/1000
JOURNAL_STREAM=9:20496
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/spool/mail/ivar
OLDPWD=/home/ivar
WINDOWID=6291462
ivararch% tr '\0' '\n' < /proc/$PPID/environ
SHELL=/bin/zsh
XDG_SEAT=seat0
PWD=/home/ivar
LOGNAME=ivar
XDG_SESSION_TYPE=tty
XAUTHORITY=/home/ivar/.Xauthority
DESKTOP_STARTUP_ID=i3/i3-sensible-terminal/552-0-ivararch_TIME33792
WINDOWPATH=1
HOME=/home/ivar
INVOCATION_ID=b944c9fa12e74b15aedcc7822b200c70
XDG_SESSION_CLASS=user
TERM=linux
USER=ivar
DISPLAY=:0
SHLVL=1
XDG_VTNR=1
XDG_SESSION_ID=1
XDG_RUNTIME_DIR=/run/user/1000
JOURNAL_STREAM=9:20496
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/spool/mail/ivar
OLDPWD=/home/ivar

Offline

#12 2019-06-04 15:50:32

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

Re: Can't type åäö into st or xterm

Can you please try whether uxterm behaves like xterm or instead like you would want it? (So we know what to focus on, the environment show no overrides to the system locale)
You could likewise try to run

LC_ALL=… WHAHHH

configure "sv_SE.UTF-8" and "en_US.UTF-8"

Fuck. ;-)

Offline

#13 2019-06-04 16:08:14

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

Hm....

I reinstalled xterm, and it seems that åäö is working just fine in both xterm and uxterm. Locale and localectl outputs are identical for both xterm and st.

This narrows it down to st being the problem. I've looked through config.h, but I can't really see any locale options there, and I'm not C-savvy enough to look through the rest of the source for it.

Offline

#14 2019-06-04 16:20:32

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

Re: Can't type åäö into st or xterm

Your locale config is (still) wrong (though I tried st and it seems to accept the alternative spelling as well)
Try to run explicitly

LC_ALL=en_US.UTF-8 st

and see how that instance behaves.

Offline

#15 2019-06-04 16:39:07

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

Now I'm completely lost as to what's going on. Am I missing something or should these two instances be behaving the same way (the right one is the instance started on the left)

https://i.imgur.com/mE96hE9.png

Offline

#16 2019-06-04 16:46:35

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

Re: Can't type åäö into st or xterm

The locale can still be influenced by the shell (though in that case just starting one st out of the other should work, w/o even altering LC_CTYPE or any other value)

Offline

#17 2019-06-04 16:56:16

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

That does indeed seem to be the case. Just running st without anything else seems to result in åäö working just fine in the new instance.

Offline

#18 2019-06-04 16:57:06

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

Re: Can't type åäö into st or xterm

cat /etc/locale.conf

Offline

#19 2019-06-04 17:21:48

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

ivararch% cat /etc/locale.conf
LANG=sv_SE.UTF-8
LC_CTYPE=sv_SE.UTF-8
LC_NUMERIC=sv_SE.UTF-8
LC_TIME=sv_SE.UTF-8
LC_COLLATE=sv_SE.UTF-8
LC_MONETARY=sv_SE.UTF-8
LC_MESSAGES=en_US.UTF-8
LC_PAPER=sv_SE.UTF-8
LC_NAME=sv_SE.UTF-8
LC_ADDRESS=sv_SE.UTF-8
LC_TELEPHONE=sv_SE.UTF-8
LC_MEASUREMENT=sv_SE.UTF-8
LC_IDENTIFICATION=sv_SE.UTF-8

Edit: I have also come to notice that it probably isn't i3 causing issues since it behaves the same way if I launch it through dmenu.

Last edited by PorousBoat (2019-06-04 17:26:23)

Offline

#20 2019-06-04 18:32:52

PorousBoat
Member
Registered: 2019-06-04
Posts: 11

Re: Can't type åäö into st or xterm

I have come up with a half-baked solution in launching st with an LC_CTYPE env variable when launching it from i3. This works, but kind of sidesteps the problem rather than solving it, and thus I don't want to mark the thread as solved yet.

The problem seems to be that for whatever reason the locale environment variables aren't being properly set when st is launched from outside an existing shell instance. As for why, I'm clueless. Uxterm works, and urxvt also works with some coaxing.

Offline

#21 2019-06-04 20:18:14

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

Re: Can't type åäö into st or xterm

tr '\0' '\n' < /proc/$(pidof i3wm)/environ

?
Also your ~/.xinitrc might shed some light.

Offline

Board footer

Powered by FluxBB