WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: gtk2 and german umlauts (utf-8) in the title of a popup window  (Read 6089 times)

Offline emmi

  • Newbie
  • *
  • Posts: 29
gtk2 and german umlauts (utf-8) in the title of a popup window
« on: November 25, 2019, 05:15:27 PM »
I ran an gtk2 application on TinyCore 5.4 and everything worked as expected, including german umlauts, within the window, the input fields and, and ... I updated to version 10.1 and now all titles in a popup window shows ? instead of the expected umlaut.  All the other occurrences of umlauts seem to be correct. (I also had version 6.4.1 available, which shows the same wrong titles.) Obviously something changed. But what and how can I fix it or work around it?

I only install (zip-unzip and) gtk2, nothing else, no locale, no font, no nothing.

Installing gtk2 is different, there seem to be different dependencies which trigger different extensions to be installed and a different order to install the common ones. But I failed to figure out, if and which one/s is/are missing in the10.1 (or 6.4.1) extensions.

I hope someone with more insight into gtk2 can help.

Thanks.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11698
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #1 on: November 25, 2019, 09:19:37 PM »
Hi emmi
...  (I also had version 6.4.1 available, which shows the same wrong titles.) Obviously something changed. ...
Starting with version 6  shared-mime-info.tcz  was removed from the dependency file. In addition, the following files no longer
showed up in the  gtk2.tcz.tree  file:
Code: [Select]
libFS.tcz
libICE.tcz
libSM.tcz
libXaw.tcz
libXfont.tcz
libXmu.tcz
libXpm.tcz
libXres.tcz
libXss.tcz
libXt.tcz
libXtst.tcz
libXv.tcz
libXvmc.tcz
libXxf86dga.tcz
libdmx.tcz
libfontenc.tcz
libxkbfile.tcz
libxml2.tcz

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 11049
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #2 on: November 26, 2019, 02:35:19 AM »
Did the WM change? The WM is responsible for drawing the title bars.
The only barriers that can stop you are the ones you create yourself.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #3 on: November 26, 2019, 10:33:49 AM »
emmi, I was not able to reproduce your issue: I booted my Pure64 10.1 box with a minimal onboot.lst (only Xorg-7.7, my intel graphics extension, and thunderbird-appimage.tcz as a representative gtk2 application) and umlauts show up fine in all of thunderbird's boxes and title bars. So in my experience they show up fine even without loading mylocale.tcz and without loading any fonts. My WM is fluxbox.

The only places where I find I need special care is needed to display Unicode characters is in my web browser (iridium-browser.tcz, which needs a Unicode font--I use dejavu-fonts-ttf.tcz) and in my terminal emulator (rxvt.tcz, which needs a UTF-8 locale). aterm does not support Unicode (see here).

The extension getlocale.tcz walks the user through creating mylocale.tcz extension. You'll need a boot code that matches the locale in mylocale.tcz (for example, if mylocale.tcz contains en_US.UTF-8, then you need the boot code lang=en_US.UTF-8).
« Last Edit: November 26, 2019, 10:50:52 AM by GNUser »

Offline emmi

  • Newbie
  • *
  • Posts: 29
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #4 on: November 26, 2019, 05:03:29 PM »
Thanks for getting back to  me on this. I will try to install the removed extensions. Some of them seem to be installed anyway, maybe as an indirect dependency.

As I said, the error is reproducible at will: just booting the iso image, adding gtk2 and running the app. I can make screenshots. I could patch the app and replace the utf-8 รถ, two bytes, with oe and that correctly showed. But I don't want to do that for all these strings.

FWIW, in the app, near the title string, I saw the string "dialog". Knowing  nothing about gtk, I said popup window.

PS: Yes, I entered this in the wrong forum but didn't know how to move it myself.

Offline emmi

  • Newbie
  • *
  • Posts: 29
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #5 on: December 04, 2019, 04:33:30 PM »
I installed all the removed tces as listed here http://forum.tinycorelinux.net/index.php/topic,23351.msg146250.html#msg146250 but that didn't change anything. As can be seen from the appended screenshot, the title bar of an aterm correctly shows the umlaut, the text in the window and boxes show the umlauts, but the dialog/popup box has it wrong. I suspect there is something broken, very likely in gtk2.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #6 on: December 05, 2019, 10:54:54 AM »
Your WM (window manager) can properly display umlauts in titlebars, as your screenshot shows.

GTK2 is only involved here if it's the toolkit that your WM uses. FWIW, GTK2 supports UTF-8 out of the box (see https://wiki.gentoo.org/wiki/UTF-8#KDE.2C_GNOME.2C_and_Xfce).

What WM are you using? It seems that your WM's graphical toolkit and this specific application are butting heads, probably over encoding--i.e., the application used one encoding to store the characters, but WM's toolkit is assuming a different encoding. The two encodings agree on how to represent basic ASCII characters (I think most encodings agree on that), but not the expanded Latin characters. That's my theory, anyway.

If you specify a locale (see my prior post) does it make the problem go away?

« Last Edit: December 05, 2019, 10:59:28 AM by GNUser »

Offline emmi

  • Newbie
  • *
  • Posts: 29
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #7 on: December 05, 2019, 06:51:10 PM »
Yes, for aterm the WM displays the UTF-8 encoded umlaut in the title without any problem.

And, as mentioned before, the application worked without any problem on tcl 5.4, I only installed GTK2, nothing else.

The WM is whatever comes with tcl. Because GTK2 is not installed by default, the WM doesn't use it. As mentioned before, there is UTF-8 in the application, the shown message is hard coded. If I change the encoded umlaut to two ASCII characters, they are shown. For the aterm example I used the encoded umlaut from the application, modified a script with hexedit.

I installed getlocale, selected de_DE.UTF-8, loaded mylocale, nothing changed. Again, locale was not necessary on tcl 5.4.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #8 on: December 06, 2019, 06:59:30 AM »
emmi - sorry to hear using the locale didn't help.

It sounds like you are familiar with the application's source code. My last thought is to check the encoding of the file that contains the strings used in title bar. If it is something other than UTF-8, change the encoding to UTF-8 then recompile your application.

Take a look here: https://www.shellhacks.com/linux-check-change-file-encoding/

P.S. The file utility is in file.tcz, iconv utility is in glibc_apps.tcz
« Last Edit: December 06, 2019, 07:29:08 AM by GNUser »

Offline emmi

  • Newbie
  • *
  • Posts: 29
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #9 on: December 06, 2019, 05:32:10 PM »
I'm not a GTK2 programmer but managed to copy an example from the net and adjust it for demonstration purpose. The program was compiled on a different Linux system. The binary, the object, the source and how it was built is in the appended ZIP file. The binary works as expected on 5.4, just install GTK2; it does not work on 6.4.1 (and newer versions) with GTK2 and locale installed. It uses the gtk_window_set_title() with an UTF-8 encoded umlaut.

If someone wants to try it...
« Last Edit: December 06, 2019, 08:21:26 PM by Rich »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11698
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #10 on: December 06, 2019, 08:36:34 PM »
Hi emmi
Attaching binaries to posts is against forum rules. See item 2 here:
http://forum.tinycorelinux.net/index.php/topic,7738.0.html
I repackaged your attachment to include only the source file and build script.

Offline emmi

  • Newbie
  • *
  • Posts: 29
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #11 on: December 08, 2019, 08:15:53 AM »
OK. The intention was to provide a environment similar to the one I have with the real application, which is only available as a binary. I don't know if compiling on tcl will make a difference. I hope it  will not and I hope someone can identify the problem with this small reproducer, fix it or give a workaround.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11698
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #12 on: December 08, 2019, 09:41:03 AM »
Hi emmi
I understand. If someone prefers to try the binary without compiling it themselves, they are free to say so. You can email them a
copy or upload it to a file hosting site and PM them a download link.

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #13 on: December 09, 2019, 08:40:59 AM »
I think I've found a different symptom of the same problem.

In all GTK2 and GTK3 applications, I get an error ("Invalid file name") in file selection box whenever I include any Unicode character in the filename. Here's an example when using a GTK3 application:



I'm using a Unicode locale:
Code: [Select]
bruno@box:~$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

In Devuan, the same GTK2 and GTK3 applications accept Unicode characters in file names.

In TCL, I do not have this problem with applications that use a different graphical toolkit (e.g., xfe file manager uses fox toolkit; xfe can create new files and directories with Unicode characters in their names).

Maybe current GTK2 and GTK3 versions in Pure64 repository were not compiled with full Unicode support?
« Last Edit: December 09, 2019, 08:46:46 AM by GNUser »

Offline GNUser

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1530
Re: gtk2 and german umlauts (utf-8) in the title of a popup window
« Reply #14 on: December 09, 2019, 12:49:32 PM »
@Rich - I'm not sure whether the problem in my prior post is related to OP, so I'll open a new thread. Feel free to delete my post above.

If I find a fix for my issue, I'll share it in this thread so that emmi can try it. I think that would be the easiest way to know whether his issue and mine are related.
« Last Edit: December 09, 2019, 12:59:08 PM by GNUser »