Bug 52655 (suse37655) - UTF-8 in xterm title
Summary: UTF-8 in xterm title
Status: RESOLVED FIXED
Alias: suse37655
Product: SUSE LINUX 10.0
Classification: openSUSE
Component: X11 Applications (show other bugs)
Version: Beta 2
Hardware: All Linux
: P3 - Medium : Minor
Target Milestone: ---
Assignee: Mike Fabian
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-31 18:06 UTC by Vladimir Nadvornik
Modified: 2006-04-26 13:51 UTC (History)
5 users (show)

See Also:
Found By: Other
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
utf8-title-resource.patch (592 bytes, patch)
2006-04-26 13:25 UTC, Mike Fabian
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Nadvornik 2004-03-31 18:06:29 UTC
Setting xterm title to utf-8 string via escape sequences does not work. 
 
It is one of the problems reported in bug 52542
Comment 1 Vladimir Nadvornik 2004-03-31 18:06:29 UTC
<!-- SBZ_reproduce  -->
LANG=cs_CZ.UTF-8 
in xterm in WindowMaker: 
echo -ne "\033]0;abcýöáädef\007" 
You get xterm title with broken or missing characters. 
 
The same works in konsole.
Comment 2 Stefan Dirsch 2004-03-31 19:39:08 UTC
I can reproduce this with KDE. Might work only by accident in konsole. Mike 
needs to investigate this further. Anyway, this is minor IMHO ... 
 
Comment 3 Stefan Dirsch 2004-04-06 00:13:43 UTC
Mike. Only when time permits ... 
Comment 4 Matthias Hopf 2004-09-24 03:57:28 UTC
This is windowmanager indepenendend and as as I see it not special to cs_CZ:

LANG=de_DE.UTF-8 xterm -> echo -ne "\033]0;abcöädef\007"
does not work either. It does not work with fvwm2 either.
Comment 5 Stefan Dirsch 2005-05-24 10:12:00 UTC
Setting titles in KDE doesn't work at all. Probably KDE overwrites them again
immediately. Anyway, it still seems not to be fixed with xterm-202. I've tested
with fvwm2 (but this might be also a bug in fvwm2).

changelog for xterm-201:
* modify parsing of OSC (and SOS, etc), strings so their contents are not  
  interpreted as UTF-8. This allows non-ASCII title strings to be set, 
  provided that the window manager complies (report by Thomas Wolff).
Comment 6 Mike Fabian 2005-08-22 18:48:52 UTC
The example in comment #1 works now, both with "echo" and with
"xtermset":

    echo -ne "\033]0;abcýöáädef\007"
    xtermset -title "abcýöáädef"

Tested under fvwm2-2.5.12.

But it does not work anymore as soon as characters which are not
in Latin-1 are involved, i.e.

    mfabian@magellan:~$ echo -ne "\033]0;ač\007"
    mfabian@magellan:~$ echo -ne "\033]0;a€\007"

do *not* work.
Comment 7 Mike Fabian 2005-08-22 18:53:00 UTC
Could be related to the following comment in the xterm sources (misc.c, line 2202):

    #if OPT_WIDE_CHARS
	/*
	 * Title strings are limited to ISO-8859-1, which is consistent with the
	 * printable data in sos_table.  However, if we're running in UTF-8 mode,
	 * it is likely that non-ASCII text in the string will be rejected because
	 * it is not printable in the current locale.  So we convert it to UTF-8,
	 * allowing the X library to convert it back.
	 */
	if (xtermEnvUTF8()) {

Comment 8 Mike Fabian 2005-08-23 09:36:43 UTC
In comment #6 I wrote that I tested under fvwm2 and it worked.
But it doesn't work under KDE.

With konsole and gnome-terminal it works just fine under FVWM2 *and*
KDE, therefore I think this is not the fault of KDE but the fault of
xterm.


Comment 9 Mike Fabian 2005-08-23 09:39:50 UTC
sndirsch> Setting titles in KDE doesn't work at all. Probably KDE overwrites
sndirsch> them again immediately.

This is bcause our default prompt for bash looks like this:

    linux@rossini:~> echo $PS1
    $(ppwd \l)\u@\h:\w>
    linux@rossini:~>

which writes the current path in the title of the terminal.

Therefore, the easiest way to check whether setting the titles doesn't
works with our default settings is:

    mkdir äöü
    cd äöü



   
Comment 10 Mike Fabian 2005-08-23 10:07:06 UTC
Add xterm author Thomas Dickey <dickey@herndon4.his.com> to CC: .
Comment 11 Thomas Dickey 2005-08-26 19:06:32 UTC
Actually "herndon4.his.com" has been obsolete for a while (can someone
change this?).

According to my rcs logs -
I investigated it in mid-April with fvwm and had poor results (it worked
one day, not the next - using the same stable copy of fvwm2 2.4.6).
It happened to work for ion3 - which also required the conversion,
and since this seems to be supported by _some_ window managers
(google pointed to a couple more), and those that do seem to require the
conversion, I left it in.
Comment 12 Thomas Dickey 2006-04-07 16:17:18 UTC
I revisited this one -
Patch #210 - 2006/3/12 - XFree86 4.5.99.902
add utf8Title resource and menu entry, allowing the user to control whether title strings are interpreted as ISO-8859-1 or UTF-8 encoding (Novell #52655, #113206).
Comment 13 Stefan Dirsch 2006-04-18 11:07:33 UTC
Thanks, Thomas. I'll update to xterm-212 for SL 10.2 next week.
Comment 14 Stefan Dirsch 2006-04-21 11:27:24 UTC
Works, when enabling it via the menu entry, but I didn't succeed in setting it by the according XTerm resource (shouldn't it be 'XTerm.utf8-tile: true' or 'XTerm.utf8Title: true'?). Maybe you can help here.

What about setting it to "uDefault" in the sources? Might this be problematic
for some window managers?

Comment 15 Mike Fabian 2006-04-21 11:58:12 UTC
The correct resource seems to be

    XTerm.utf8Title: 3

and the possible values seem to be 0, 1, 2, and 3, just like for the utf8 resource.
The utf8Title resource is apparently not yet documented in the manual page.
Comment 16 Stefan Dirsch 2006-04-21 13:18:28 UTC
Thanks, Mike. I'll use this setting by default by adding it to the app-defaults file. Fixed for SUSE 10.2 Alpha1.
Comment 17 Thomas Dickey 2006-04-21 17:35:30 UTC
utf8Title is a boolean, not an integer.

(yes, I see that I forgot to add it to the manpage).
Comment 18 Mike Fabian 2006-04-21 17:40:41 UTC
Thomas Dickey> utf8Title is a boolean, not an integer.

Are you sure?

We tried

    XTerm.utf8Title: true

but it did't work. Then we tried

    XTerm.utf8Title: 1

and this did work. We were surprised and had a quick look at the source
code and had the impression that it is an integer with values from 0 to 3.

But of course we might be completely wrong here.

Comment 19 Thomas Dickey 2006-04-21 18:00:18 UTC
yes - I just checked.  The relevant variable is screen->utf8_title,
which is declared as a Boolean in ptyx.h (perhaps there's some bug
to investigate, but that's what the variable is supposed to be).
Comment 20 Mike Fabian 2006-04-26 12:48:06 UTC
Yes, I think there is a bug somewhere. With

    XTerm*utf8Title: true

in the Xresources I get the warning on stdout:

    mfabian@magellan:~$ xterm
    Warning: Cannot convert string "true" to type Int
    mfabian@magellan:~$

and the UTF-8 Titles option is off (checked with Control+Rightmouse).

Comment 21 Mike Fabian 2006-04-26 13:25:47 UTC
Created attachment 80266 [details]
utf8-title-resource.patch

I think the attached patch fixes the problem.
Comment 22 Thomas Dickey 2006-04-26 13:32:28 UTC
yes, that's right.  I looked for that on Friday, but did not see it.
Comment 23 Stefan Dirsch 2006-04-26 13:51:36 UTC
Thanks. We'll take the patch for now and will update to the next version ASAP to get rid of it again.