GNOME Bugzilla – Bug 321597
Problem with non-codepage characters in window title
Last modified: 2006-09-03 22:50:41 UTC
Please describe the problem: I'm having trouble setting a window title (window.set_title('')) when the title-string includes a special character, specifically a specially modified character called macron (e.g.: ā). windows then wouldn't want to show the title at all anymore. (i was told it is showing on linux though.) maybe this is a bug? or is there a way to solve this problem? Steps to reproduce: 1. create a gtk.window 2. window.set_title('lālala') Actual results: title is not shown anymore at all Expected results: title-string should be displayed in window Does this happen every time? yes Other information: this does not happen with all diacritical letters. e.g. circumflexe (â) and umlauts / tremas (ä) are correctly shown.
Is this on XP, 2000 or Win9x? What is your system codepage? (What language version of Windows are you using?) Your sample is Python, right? Do you use UTF-8 or system codepage for the string in that set_title call? You should use UTF-8 at least from C, but I don't know if the GTK+ bindings for Python perhaps automatically converts from system codepage to UTF-8. If the string is in system codepage, try using UTF-8 instead. It might also be a good idea to ask in some Python-specific forum.
Also, what is the exact GTK+ version you are using? (Check the properties of the libgtk-win32-2.0-0.dll file.) gdk_window_set_title() was fixed between 2.6.8 and 2.6.9: 2005-07-21 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkwindow-win32.c (gdk_window_set_title): Use wide-char API when available. (#311079, Peter Zelezny) This means that if you are using an older version of GTK+ than 2.6.9, you won't be able to use characters not in your system codepage even if you are using NT-based Windows (2000, XP).
my sample is python, yes. i'm using the german language version (and codepage) of windows xp. i'm using utf-8 for my application ( # -*- coding: UTF8 -*- ). i updated my gtk+-versions to the current releases from http://gladewin32.sourceforge.net (2.8.6.-rc3), now the string gets displayed, but incorrectly, i.e. without the macrons: it's showing a regular a instead of an ā.
*** Bug 321617 has been marked as a duplicate of this bug. ***
Hmm, now when I test, Windows doesn't allow characters outside the system codepage to be used in GTK+ window titles. (They are either shown as question marks, or converted to some "equivalent" character, like you see that the a with macron is converted to just an a.) I thought I had tested this before, and been able to see for instance Greek or Chinese in the titles. But I guess I recall wrong. Reading bug #311079, the inital report indeed says that for instance c with caron shows as plain c, which matches what I see now. Probably the window needs to be created as a Unicode window in order to be able to have characters outside the system codepage in the title. I am a bit worried that doing that change might have other consequences, too. Will need some experimentation.
In HEAD we now use the wide character API for window creation and message handling. That fixes this problem, and doesn't seem to have any immediately obvious bad side effects. Won't bother backporting to stable branch, as that is supposed to use wide character API only conditionally. 2006-09-04 Tor Lillqvist <tml@novell.com> * gdk/win32/gdkevents-win32.c * gdk/win32/gdkwindow-win32.c: Use wide-char API for message and window handling (PeekMessage, PostMessage, SendMessage, DispatchMessage, DefWindowProc, RegisterClassEx, CreateWindowEx). (#321597)