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 783347 - gtkfilechoosernativewin32: Fix support for non-ASCII paths
gtkfilechoosernativewin32: Fix support for non-ASCII paths
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2017-06-02 11:03 UTC by Christoph Reiter (lazka)
Modified: 2017-06-02 11:57 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gtkfilechoosernativewin32: Fix support for non-ASCII paths (2.32 KB, patch)
2017-06-02 11:03 UTC, Christoph Reiter (lazka)
committed Details | Review

Description Christoph Reiter (lazka) 2017-06-02 11:03:23 UTC
Created attachment 353075 [details] [review]
gtkfilechoosernativewin32: Fix support for non-ASCII paths

The code used SIGDN_URL to get an URL for the selected item, but Windows URLs
are a mix of unicode and percent encoded characters in the locale encoding
and not something GFile can understand. The result is a garbage file
path.

Instead use SIGDN_FILESYSPATH to get a real file path if available.

Also checks the return value of g_utf16_to_utf8 because file paths on
Windows can contain lone surrogates which would make the conversion fail.
Comment 1 Ignacio Casal Quinteiro (nacho) 2017-06-02 11:07:41 UTC
Review of attachment 353075 [details] [review]:

Looks good to me.
Comment 2 Christoph Reiter (lazka) 2017-06-02 11:23:24 UTC
Thanks!
Comment 3 Christoph Reiter (lazka) 2017-06-02 11:57:06 UTC
Small correction: Looks like Windows URLs percent encode the _unicode code points_, no codepage stuff involved. Doesn't affect the fix here..