Re: [patch] [bug 432510] samba filename encoding on none UTF-8 locales



I updated the patches. It seems to be better to provide some options.
Which options can be acceptable?


Option 1: Fixes nautilus-file.c only
http://bugzilla.gnome.org/attachment.cgi?id=88990&action=view
The option 1 is to fix nautilus-file.c only.
Merit
 - This is a small fix with one file.
Demerit
 - This does not fix the similar problems on other GUIs.


Option2: Provide nautilus_use_local_charset() for the high visible UI
http://bugzilla.gnome.org/attachment.cgi?id=88991&action=view
The option 2 is to provide nautilus_use_local_charset() for the high visible
UI.
Merit
 - The fix is closed in nautilus side
 - Fixes the high visible UI.
Demerit
 - It's likely that this is also affecting lots and lots of other places.


Option 3: Provide gnome_vfs_locale_uri_to/from_utf8()
http://bugzilla.gnome.org/attachment.cgi?id=88992&action=view
The option 3 is to provide gnome_vfs_locale_uri_to/from_utf8().
Merit
 - It may be a preferable way.
Demerit
 - gnome-vfs is deprecated now.


Alexander Larsson wrote:
-locale_name = g_filename_from_utf8 (new_name, -1, NULL, NULL, NULL);
+locale_name = g_convert (new_name, -1, filename_charset, "UTF-8", NULL, NULL, NULL);

This changes nothing. This is exactly what g_filename_from_utf8() would
do.

OK, I updated this.


You said that setting G_BROKEN_FILENAMES_SMB is supposed to make
nautilus use the encoding of the locale for smb uris. However, the code
you just posted uses the encoding that is used for filenames when
G_BROKEN_FILENAMES_SMB is set. So, if G_BROKEN_FILENAMES_SMB is set, but
G_BROKEN_FILENAMES is not set, or if G_FILENAME_ENCODING is set to
something else then it doesn't do what you wanted.

Now, perhaps that is a better thing to do for your usecase, but in that
case the name of the env var is pretty confusing, and you should use
something better.

I see.
How about G_USE_LOCAL_CHARSET_FOR_SMB_FILENAMES ?


+gboolean nautilus_use_local_charset_from_path (const char *text_uri);
+gboolean nautilus_use_local_charset_from_uri (const GnomeVFSURI *uri);
+use_local_charset (NautilusFile *file)

These are very confusing. local and locale are two very different
things. Also, a text_uri is not a "path".
nautilus_use_local_charset_from_uri is also extremely inefficient,
turning the parsed uri into a string just to look at the method name.

I renamed those those functions to follow the scheme of gnome_vfs_remove_directory_from_uri.


Its likely that this is also affecting lots and lots of other places. In
fact, every place in the desktop (including things like the file
selector). I really don't think this can be handled by finding each
place and adding in some smb specific code. A real solution would
include adding the same kind of API as g_filename_to/from_utf8() to
gnome-vfs and using it consistantly everywhere. However, since gnome-vfs
is to be deprecated and the replacement has the proper API for this
(display name and on-disk name is properly separated in the API) it
seems like a bad idea to try to enforce this at this point.

So, I don't really think that this solution is right at this point.
Sorry.

I updated three patches. What do you think there are any ways to fix this problem tentatively until gvfs is available?




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]