Bug 30757 - file:// URLs do not decode non-latin symbols (patch included)
Summary: file:// URLs do not decode non-latin symbols (patch included)
Status: RESOLVED FIXED
Alias: None
Product: Portland
Classification: Unclassified
Component: xdg-utils (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Portland Bugs
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-10 11:18 UTC by VL
Modified: 2011-02-10 13:44 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Implement URL decoding for non-latin symbols in file:// URLs (706 bytes, application/octet-stream)
2010-10-10 11:18 UTC, VL
Details

Description VL 2010-10-10 11:18:05 UTC
Created attachment 39324 [details]
Implement URL decoding for non-latin symbols in file:// URLs

Attempt to open file:// URL with non-latin symbols in it leads
to failure, because no decoding happens for URL. The script
tests if file exists and gets false result, because it attempts to
find a name with stuff file this '%D0%B3%D0%BB%D0%B' in name.

Appropirate place in script is marked as 'TODO'.

For example this is what happens when i try to open local filename
with name in russian from my Qt program:

Attempt to open: QUrl( "file:///home/vl/.local/share/data/mentat/EGRP/data/01. Назначение ЭГРП/1. Назначение гидроприводов Л.А.pdf" )
xdg-open: file '/home/vl/.local/share/data/mentat/EGRP/data/01.%20%D0%9D%D0%B0%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5%20%D0%AD%D0%93%D0%A0%D0%9F/1.%20%D0%9D%D0%B0%D0%B7%D0%BD%D0%B0%D1%87%D0%B5%D0%BD%D0%B8%D0%B5%20%D0%B3%D0%B8%D0%B4%D1%80%D0%BE%D0%BF%D1%80%D0%B8%D0%B2%D0%BE%D0%B4%D0%BE%D0%B2%20%D0%9B.%D0%90.pdf' does not exist

The xdg fails to open file, although it exists:

$ file "/home/vl/.local/share/data/mentat/EGRP/data/01. Назначение ЭГРП/1. Назначение гидроприводов Л.А.pdf"
/home/vl/.local/share/data/mentat/EGRP/data/01. Назначение ЭГРП/1. Назначение гидроприводов Л.А.pdf: PDF document, version 1.4

The problem can be easily fixed with suggested patch - it decodes URL using sed, no perl/php is required.
The solution was obtained here: http://spielwiese.la-evento.com/xelasblog/archives/23-URL-decode-und-encode-in-der-Bash.html - thanks to unknown german man ;-)

UPD:
I reviewed CVS history of xdg-open and found that url decoding was
remvoed in Revision 1.48 with comment 'It still need some work.'

I've tested suggested solution and it really doesn't work. My patch works
at least for me well.

The patch is against gentoo's version, but applies to xdg-open rev 1.52 as well and works.

I'd like to see this problem fixed, since it blocks the ability for user to open files with non-latin names using standard methods.
Comment 1 VL 2011-02-10 13:39:00 UTC
Looks like it was fixed at this commit: http://cgit.freedesktop.org/xdg/xdg-utils/commit/?id=25af23cb3edf9accde30a5aae36fd6579445bd99
at least works for me.

Thanks, guys!
Comment 2 Rex Dieter 2011-02-10 13:44:18 UTC
I guess we can consider it fixed, though the patch here does seem a bit more elegant.  :)


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.