After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 148420 - g_unescape_uri_string still expects unescaped string to be utf-8
g_unescape_uri_string still expects unescaped string to be utf-8
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.4.x
Other All
: High normal
: ---
Assigned To: gtkdev
gtkdev
: 148484 (view as bug list)
Depends on:
Blocks: 148140
 
 
Reported: 2004-07-25 15:00 UTC by Robert Ögren
Modified: 2011-02-18 16:07 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Robert Ögren 2004-07-25 15:00:12 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;
Comment 1 Owen Taylor 2004-07-26 12:09:37 UTC
*** Bug 148484 has been marked as a duplicate of this bug. ***
Comment 2 Michael Natterer 2004-07-26 12:21:13 UTC
Um, apparently not looking for duplicates before reporting doesn't
only apply to GIMP users... ;)
Comment 3 Matthias Clasen 2004-07-30 19:00:47 UTC
Fixed in both branches. I've also added roundtrip tests to uri-test.c