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

On Tue, 2007-05-22 at 23:21 +0900, Takao Fujiwara - Tokyo S/W Center
> Alexander Larsson wrote:
>  > Eh, this looks even worse. It never looks at G_BROKEN_FILENAMES_SMB.
> Sorry, I misunderstood your request.
> I updated the patch. Could you review the attachment?

-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

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 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.

+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 noticed the copy progress dialog also has the same problem so I modified nautilus-file-operations.c, too.
> Could you also review this?

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.

 Alexander Larsson                                            Red Hat,
                   alexl redhat com    alla lysator liu se 
He's a genetically engineered dishevelled ex-con living undercover at Ringling 
Bros. Circus. She's a mistrustful bisexual bounty hunter from beyond the 
grave. They fight crime! 

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