GNOME Bugzilla – Bug 140532
g_filename_to_uri() should not encode flenames in UTF-8
Last modified: 2011-02-18 16:07:29 UTC
1. export LANG=es_MX.ISO8859-1 2. export G_FILENAME_ENCODING=@locale 3. open gedit 4. Save a file called "αινσϊ" 5. Try to open the file Gedit says that the file does not exist and whether you would like to create it. The problem is that g_filename_to_uri() considers filenames to be in UTF-8. It shouldn't do this, as filenames don't have a specified encoding. See the detailed report here: http://mail.gnome.org/archives/gtk-devel-list/2004-April/msg00148.html The attached patch fixes this in g_filename_to_uri() and g_filename_from_uri().
Created attachment 26827 [details] [review] Patch with proposed fix.
Fixing the summary since the current code doesn't assume filenames are UTF-8, rather it encodes them in UTF-8 before creating the URL.
What needs to happen here is that somebody must check that this doesn't negatively affect large parts of Gnome. If it doesn't, we should get it in 2.4.2. If it does, we should get it in 2.6 and make sure people are aware of what needs fixing when they move to gtk+ 2.6.
I did a recursive grep on the sources, and only the GIMP seems to use it in a few places. I think we should fix it as soon as possible.
*** Bug 107695 has been marked as a duplicate of this bug. ***
*** Bug 120089 has been marked as a duplicate of this bug. ***
Fixed in both HEAD and the glib-2-4 branches.
*** Bug 140980 has been marked as a duplicate of this bug. ***