Debian – Swedish unicode characters in xdm / xlogin

debianfontsunicodexorg

I decided to localize my XDM login screen but I'm stuck with corrupted Swedish characters.

enter image description here

I'm using Debian Wheezy with the following /etc/X11/xdm/Xresources

Xcursor.theme: whiteglass

xlogin*login.translations: #override \
        CtrlR: abort-display()\n\
        F1: set-session-argument(failsafe) finish-field()\n\
        Delete: delete-character()\n\
        Left: move-backward-character()\n\
        Right: move-forward-character()\n\
        Home: move-to-begining()\n\
        End: move-to-end()\n\
        CtrlKP_Enter: set-session-argument(failsafe) finish-field()\n\
        KP_Enter: set-session-argument() finish-field()\n\
        CtrlReturn: set-session-argument(failsafe) finish-field()\n\
        Return: set-session-argument() finish-field()

!xlogin*greeting: V\303\244lkommen till CLIENTHOST
xlogin*greeting: Välkommen till CLIENTHOST
xlogin*namePrompt: Användare:
!xlogin*fail: Fel l\303\266senord!
xlogin*fail: Fel lösenord!

!xlogin*greetFace:       Inconsolata:size=16
!xlogin*face:            Inconsolata:size=14
!xlogin*promptFace:      Inconsolata:size=14
!xlogin*failFace:        Inconsolata:size=20
xlogin*greetFace -*-fixed-medium-r-*--*-200-*-*-*-*-iso8859-15
xlogin*failFace -*-fixed-medium-r-*--*-200-*-*-*-*-iso8859-15
xlogin*promptFace -*-fixed-medium-r-*--*-200-*-*-*-*-iso8859-15
xlogin*face -*-fixed-medium-r-*--*-200-*-*-*-*-iso8859-15

xlogin*borderWidth: 0
xlogin*frameWidth: 0
xlogin*innerFramesWidth: 0
xlogin*shdColor: grey30
xlogin*hiColor: grey90
xlogin*background: grey
!xlogin*foreground: darkgreen
xlogin*greetColor: black
xlogin*failColor: red
*Foreground: black
*Background: #fffff0

xlogin*logoFileName: /home/stemid/heart.xpm
xlogin*useShape: true
xlogin*logoPadding: 10

XConsole.text.geometry: 480x130
XConsole.verbose:       true
XConsole*iconic:        true
XConsole*font:          fixed

Chooser*geometry:               700x500+300+200
Chooser*allowShellResize:       false
Chooser*viewport.forceBars:     true
Chooser*label.font:             *-new century schoolbook-bold-i-normal-*-240-*
Chooser*label.label:            XDMCP Host Menu from CLIENTHOST
Chooser*list.font:              -*-*-medium-r-normal-*-*-230-*-*-c-*-iso8859-1
Chooser*Command.font:           *-new century schoolbook-bold-r-normal-*-180-*

/etc/X11/xdm/Xsetup

#!/bin/sh
#
# This script is run as root before showing login widget.
export LANGUAGE=sv_SE
export LANG=sv_SE
export LC_ALL=sv_SE

xsetroot -solid "#002b36"

sleep 10 && import -w root /home/stemid/.login_screen.jpg &
chown stemid:stemid /home/stemid.login_screen.jpg &

Originally I was trying with sv_SE.UTF-8 in environment but both of those locales are activated in the Debian locale-gen.

~/.xsession

export LANGUAGE=sv_SE
export LANG=sv_SE
export LC_ALL=sv_SE

test -f ~/.Xresources && xrdb ~/.Xresources

xsetroot -solid "#002b36"

xscreensaver -no-splash &
exec ratpoison

I've also tried setting the locale in .profile.

Debian generally requires no xorg.conf but I've created two files in /etc/X11/xorg.conf.d, one for the synaptics touchpad and one for font paths.

Section "Files"
ModulePath "/usr/lib/xorg/modules/"
FontPath "/usr/share/fonts/X11/misc/"
FontPath "/usr/share/fonts/X11/TTF/"
FontPath "/usr/share/fonts/X11/OTF"
FontPath "/usr/share/fonts/X11/Type1/"
FontPath "/usr/share/fonts/X11/100dpi/"
FontPath "/usr/share/fonts/X11/75dpi/"
FontPath "/usr/share/fonts/X11/misc/artwiz-aleczapka-se-1.3/"
EndSection

I've also tried installing a font that specifically supported Swedish but I can't use it in Xresources using the line from xfontsel.

xlsfonts lists all the fonts I expect to be there, including the new artwiz ones. It doesn't seem like a font issue to me, more like encoding.

Additionally I have tried dpkg-reconfigure locales and restarted X with all three settings. That is the only three locales I have enabled, and tested each as the default.

  • sv_SE
  • sv_SE.ISO-8859-1
  • sv_SE.ISO-8859-15
  • sv_SE.UTF-8

Best Answer

I suspect xdm does not support UTF-8 even though your environment may be set that way. It is is still down to the application to handle the interpretation of strings and the encoding they may contain.

To fix this issue, I removed the utf8 encoded strings and replaced them with with their ISO-8859-15 counterpart (you can get the list of iso-8859-15 sequences to use with man iso_8859-15). So this seemed to work for me:

xlogin*greeting: V\344lkommen till CLIENTHOST
xlogin*namePrompt: Anv\344ndare:
xlogin*fail: Fel l\366senord!

This also meant I didn't need to set anything in Xsetup either (I was originally trying to use sv_SE.utf8).

Related Question