GNOME Bugzilla – Bug 577241
Gtk2::FileChooser get_filename() returning byte string
Last modified: 2021-07-05 12:22:29 UTC
As noted on the mailing list a little while ago, it looks like Gtk2::FileChooser::get_filename() should return a byte string rather than treat it as utf8. The prototype for gtk_file_chooser_get_filename() has gchar*, but under the heading "Important" in the docs http://library.gnome.org/devel/gtk/unstable/GtkFileChooser.html#GtkFileChooser.description it's described as ready to pass to open() and not suitable to put in a GtkLabel. That seems to be how the code is too. In the foo.pl below clicking on the latin-1 y-diaeresis file in the selection list gets an error Malformed UTF-8 character (overflow at 0x40000036, byte 0x17, after start byte 0xff) in subroutine entry at /usr/lib/perl/5.10/Data/Dumper.pm line 190. and some printfs show it's a raw 0xFF byte. The only concern might be that when you enter a name in the entry box and press return, in that case get_filename returns utf8. Presumably that's a gtk bug. The same applies to the multi-select gtk_file_chooser_get_filenames().
Created attachment 131653 [details] failing program
Created attachment 131654 [details] [review] char instead of gchar
GNOME is going to shut down bugzilla.gnome.org in favor of gitlab.gnome.org. As part of that, we are mass-closing older open tickets in bugzilla.gnome.org which have not seen updates for a longer time (resources are unfortunately quite limited so not every ticket can get handled). If you can still reproduce the situation described in this ticket in a recent and supported software version, then please follow https://wiki.gnome.org/GettingInTouch/BugReportingGuidelines and create a new ticket at https://gitlab.gnome.org/GNOME?utf8=%E2%9C%93&filter=perl- Thank you for your understanding and your help.