2

I don't have any problem with accent (I'm French) inside xterm. However, like you can see on this screenshot, the top bar of xterm does have some accents issues:

enter image description here

However my Debian unstable system is in utf8 (so it should be good):

$ locale
LANG=fr_FR.utf8
LANGUAGE=
LC_CTYPE="fr_FR.utf8"
LC_NUMERIC="fr_FR.utf8"
LC_TIME="fr_FR.utf8"
LC_COLLATE="fr_FR.utf8"
LC_MONETARY="fr_FR.utf8"
LC_MESSAGES="fr_FR.utf8"
LC_PAPER="fr_FR.utf8"
LC_NAME="fr_FR.utf8"
LC_ADDRESS="fr_FR.utf8"
LC_TELEPHONE="fr_FR.utf8"
LC_MEASUREMENT="fr_FR.utf8"
LC_IDENTIFICATION="fr_FR.utf8"
LC_ALL=

How can I fix this little bug with xterm top bar?

3
  • Try using the Debian uxterm or lxterm wrappers. – jw013 May 19 '14 at 21:10
  • It seems that xterm is setting its title with a UTF-8 string, which your window manager interprets as latin-1 and converts to UTF-8, resulting in Ãⓒ for é. What window manager or desktop environment are you using? What are its localization settings? – Gilles 'SO- stop being evil' May 19 '14 at 22:19
  • @Gilles, no, it's xterm converting the string from latin1 to utf-8 resulting in that double-encoding. – Stéphane Chazelas May 19 '14 at 22:43
2

From the xterm documentation:

The window- and icon-labels can be set or queried using control sequences. As a VT220-emulator, xterm "should" limit the character encoding for the corresponding strings to ISO-8859-1. Indeed, it used to be the case (and was documented) that window titles had to be ISO-8859-1. This is no longer the case. However, there are many appli- cations which still assume that titles are set using ISO-8859-1. So that is the default behavior.

If xterm is running with UTF-8 encoding, it is possible to use window- and icon-labels encoded using UTF-8. That is because the underlying X libraries (and many, but not all) window managers support this feature.

The utf8Title X resource setting tells xterm to disable a reconversion of the title string back to ISO-8859-1, allowing the title strings to be interpreted as UTF-8. The same feature can be enabled using the title mode control sequence described in this summary.

Separate from the ability to set the titles, xterm provides the ability to query the titles, returning them either in ISO-8859-1 or UTF-8. This choice is available only while xterm is using UTF-8 encoding.

Finally, the characters sent to, or returned by a title control are less constrained than the rest of the control sequences. To make them more manageable (and constrained), for use in shell scripts, xterm has an optional feature which decodes the string from hexadecimal (for setting titles) or for encoding the title into hexadecimal when querying the value.

So your options are:

  1. Send the title as latin1:

    printf '\e]2;%b\a' 'T\0351l\0351chargement'
    
  2. Set the utf8Title resource to true:

    xterm*utf8Title: true
    

    in your resource file.

  3. Use the \e[>2t sequence to enable utf8Title (and \e[>2T to disable):

    printf '\e[>2t\e]2;%s\a' Téléchargement
    
0

Have you set xterm*locale: true in your .Xresources?

1
  • This is not working. – ppr May 26 '14 at 18:21

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.