Project

General

Profile

[PATCH] File chooser bugs where user has other charset than UTF-8 native

Added by Kristoffer Brånemyr almost 8 years ago

If you try to open files with characters like åäö or others and you use ISO8859-1 native encoding on the filesystem and not UTF-8, it's impossible to open the files through the file chooser. If you add them from the command line it works though.

This is because gtk filechooser returns files in native encoding and not UTF-8.
The attached patch fixes it, but perhaps it's possible to fix in a better way?


Replies (4)

RE: [PATCH] File chooser bugs where user has other charset than UTF-8 native - Added by John Lindgren almost 8 years ago

My first reaction is to say that this should be reported as a bug against GtkFileChooser. Though they shy away from saying that all URI's should be UTF-8, period, the standards seem to be tending in that direction. You can read here [1] what RFC 3986 has to say on the question. Have you discussed this with any GTK+ developers?

[1] http://tools.ietf.org/html/rfc3986#section-2.5

RE: [PATCH] File chooser bugs where user has other charset than UTF-8 native - Added by Kristoffer Brånemyr almost 8 years ago

I thought that it was by design actually, it's mentioned in the documentation:

http://developer.gnome.org/gtk3/3.2/GtkFileChooser.html
"When the user is finished selecting files in a GtkFileChooser, your program can get the selected names either as filenames or as URIs. For URIs, the normal escaping rules are applied if the URI contains non-ASCII characters. However, filenames are always returned in the character set specified by the G_FILENAME_ENCODING environment variable."

And you have to set that variable or it will assume all your files are in UTF-8.

But now when I think about it, it's a bit vague, in that you could interpret it as if only filenames and not URIs would be returned in the native character set.

RE: [PATCH] File chooser bugs where user has other charset than UTF-8 native - Added by Kristoffer Brånemyr almost 8 years ago

And no, I haven't discussed it with any gtk developers.

RE: [PATCH] File chooser bugs where user has other charset than UTF-8 native - Added by Kristoffer Brånemyr over 7 years ago

I asked this on the gtk-app-devel discussion list but I havn't got a reply.

I really think that this is the correct behaviour and not a bug in gtk. Otherwise you could not know the true pathname to the file on disk, it could even contain a mixture of UTF-8 and characters in other charsets.

Perhaps it would be better to store in the playlist both the real filename and the UTF-8 converted filename used for display.

But it should be patched somehow, please!

    (1-4/4)