GNOME Bugzilla – Bug 148420
g_unescape_uri_string still expects unescaped string to be utf-8
Last modified: 2011-02-18 16:07:52 UTC
I just upgraded to glib-2-4 from CVS, was previously using glib 2.4.1, and I can no longer open files containing non-ASCII characters in GIMP 2-0 on Windows XP (using Swedish locale). This seems to be caused by the changes made in bug #140532. More specifically, g_unescape_uri_string still checks that the unescaped string is UTF-8, which now fails. For example, when I try to open a file named C:\Robert\WÖ.xcf (there is an umlauted O before .xcf in case you don't see it) in The GIMP, the file cannot be opened. g_filename_from_uri is called with the string "file:///C:/Robert/W%D6.xcf", and that is not UTF-8 after it has been unescaped so it returns NULL. Everything seems to work fine if I remove the UTF-8 check in g_unescape_uri_string like this: Index: glib/gconvert.c =================================================================== RCS file: /cvs/gnome/glib/glib/gconvert.c,v retrieving revision 1.54.2.1 diff -u -r1.54.2.1 gconvert.c --- glib/gconvert.c 8 Jun 2004 03:31:34 -0000 1.54.2.1 +++ glib/gconvert.c 25 Jul 2004 14:46:27 -0000 @@ -1401,7 +1401,7 @@ g_assert (out - result <= len); *out = '\0'; - if (in != in_end || !g_utf8_validate (result, -1, NULL)) + if (in != in_end) { g_free (result); return NULL;
*** Bug 148484 has been marked as a duplicate of this bug. ***
Um, apparently not looking for duplicates before reporting doesn't only apply to GIMP users... ;)
Fixed in both branches. I've also added roundtrip tests to uri-test.c