Re: UTF-8 sequences in filenames



В Срд, 05.03.2003, в 11:41, Alexander Larsson написал:
> On 5 Mar 2003, Dmitry G. Mastrukov wrote:
> 
> > Hi!
> > 
> > I'd like to raise problem we (in Russian community) encountered with
> > filenames.
> > The problem exists in non-unicode locales (ru_RU.KOI8-R, ru_RU.CP1251)
> > with mamy GNOME apps (gedit, glade, nautilus at least). Files with
> > national filenames are viwed through file selector (G_BROKEN_FILENAMES
> > is set) and can be opened. But newly created files looks on filesystem
> > (in mc for example) as UTF-8 sequences.
> > We have some preliminary patches to gnome-vfs but we have no confidence
> > in that gnome-vfs is only source of problem. It should be good to find
> > out thougths of gnome-vfs developers about that.
> > We see two possibilities:
> > 1. Gnome-vfs is broken and need patching. Seems it is not using
> > g_filename_from_utf8/uri() functions from glib at all. Then where is
> > control point for possible conversion? In other words which public
> > functions work with "locale-dependant" filenames and which work with UTF
> > definitely? Brief look at gedit sources shows
> > gnome_vfs_get_local_path_from_uri is used to get filename to feed to
> > fopen(). So it should produces locale filename on output. Also may be
> > do_action() functions in method/file-method.c and some other methods
> > should use g_filename_fron_utf8/uri().
> 
> This is not right. gnome-vfs uris cannot be defined in a specific 
> encoding, just like unix pathnames cannot be. You must be able to use 
> gnome-vfs to access a file that has an invalid utf8 name for instance 
> (maybe someone created it with G_BROKEN_FILENAMES in another locale), 
> otherwise you can't rename it or delete that file. Similarily uri:s may 
> reference remote systems that don't use utf8-encoded filenames, nor your 
> local locale encoding. 
> 
> Basically, all URIs in gnome-vfs are in an filesystem-dependent unknown 
> encoding (maybe even no/several encodings, such as on a system using 
> G_BROKEN_FILENAMES with users in different locales), and it has to be that
> way for gnome-vfs to be able to access all files. However, the goal of 
> Gnome filename handling is that all files created are in either UTF8 
> (default) or at the users choice (G_BROKEN_FILENAMES is set) in the 
> current locale.
> 
> In general the filename encoding issue this is a hard problem, and a full
> real solution will not be availible for a long time, until the whole world
> has switched over to a common encoding. Many sources of filenames just 
> don't have a corresponding filename encoding specified, so until everyone 
> use the same we have to guess. Take an ftp site for instance. How are you 
> supposed to know the encoding it uses for filenames?
> 
Thanks for explanation. My last tests show that properly written apps
work fine. So seems there exist bugs in gedit and glade but not in
gnome-vfs. Now i know it's problem of particular apps.

Regards,
Dmitry





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