Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-07-20 09:24:42

nmi8080
Member
Registered: 2015-07-20
Posts: 1

Thunar clipboard and filenames with non-ascii unicode characters

Hi. When using thunar, I want to browse to a location, select all the files in a directory, copy them to the clipboard, and paste them into a text file.  When I do that I get something like this, and all is good:

file:///home/mike/workspace/org.eclipse.swt/about_files
file:///home/mike/workspace/org.eclipse.swt/about.html

However, if the directory has files with characters other than ascii (Arabic in this example), I get something like this:

file:///home/mike/test/%D8%A7%D8%B4%D8%AA%D8%A8%D8%A7%D9%83%D8%A7%D8%AA/%D8%B9%D9%86%D8%A7%D8%B5%D8%B1
file:///home/mike/test/%D8%A7%D8%B4%D8%AA%D8%A8%D8%A7%D9%83%D8%A7%D8%AA/%D9%82%D8%AA%D9%84%D9%89%20%D8%AE%D9%84%D8%A7%D9%84%20%D8%AA%D8%B8%D8%A7%D9%87%D8%B1%D8%A7%D8%AA%20%D9%81%D9%8A%20%D8%A7%D9%84%D8%AC%D9%8A%D8%B2%D8%A9

If I go to the directory in a terminal window, do an ls -l and copy/paste I get:

drwxr-xr-x 2 mike mike 4096 Jul 18 21:36 عناصر
drwxr-xr-x 6 mike mike 4096 Jul 18 21:38 قتلى خلال تظاهرات في الجيزة

I'm processing the file with all the "file:///" URLs with a program, so if there is a way to transform them from the %D8%A7... form back into real unicode, I could use that.

Any ideas?

Offline

#2 2015-07-20 16:53:48

hjudt
Member
Registered: 2014-11-27
Posts: 21

Re: Thunar clipboard and filenames with non-ascii unicode characters

I'm not quite sure about this but this seems to be intended. It is also how it is saved in the gtk bookmarks file.

As for transforming it back, you could use rather simple python code like embedded here in a bash function:

uri_encode() {
  python -c "import urllib; print 'file://' + urllib.quote('''$@''')"
}

In your case, you will need to write a function uri_decode and of course use the appropriate counterpart of quote (haven't looked it up but probably 'unquote').

Last edited by hjudt (2015-07-20 16:54:26)

Offline

Board footer

Powered by FluxBB