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-*


# 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.


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/"

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
  • 3
    That's definitely UTF-8 data interpreted as ISO-8859-1 or ISO-8859-15, at least. Not an answer but maybe a clue... Does XDM speak UTF-8 at all?
    – user
    Sep 1, 2013 at 19:27
  • Will ISO-Latin work? Perhaps just leave it at that then? Sep 1, 2013 at 22:22

2 Answers 2


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).

  • Both you and Gilles were right but you also provided me with the escape sequences to use. I love you! Sep 2, 2013 at 15:48

ä in Latin-1 is \303\244 which is UTF-8 for ä. Evidently your display manager is interpreting your strings in Latin-1 but your editor uses UTF-8.

One solution is to recode these resources from UTF-8 to Latin-1. X resources are byte strings, not character strings: it's up to the application to decide which encoding they're in.

Another solution is to tell xlogin to use UTF-8. You've configured it to use Latin-1: the locale sv_SE with no encoding indication uses Latin-1 encoding, for backward compatibility. Change those lines in /etc/X11/xdm/Xsetup to

export LC_CTYPE=sv_SE.UTF-8

You may want to set LC_MESSAGES (error and information messages), LC_COLLATE (sort order, but I don't think xlogin does anything with it) and LC_TIME (date and time format). Or set LANG, which sets all of them unless overridden with LC_xxx variables. Setting LC_ALL forces all locale categories to that value and is not necessary here, nor LANGUAGE which is only useful when you want to specify fallbacks in case a language is not available.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.