Re: Can someone please comment on this short program

On Wed, 2005-12-14 at 07:52 +0100, Matthias Kaeppler wrote:

> .. lots of stuff...

I'm not sure where the confusion is. I can't talk for the c++ bindings,
but for gnome-vfs itself the rule is:

  * file: URIs have no inherent encoding

None, nada, zilch. They are the filename as stored on disk, escaped into
a uri. As such, they are essentially escaped byte strings, the only
limit being that zero bytes and '/' bytes are not allowed. This is a
direct result of the fact that unix filenames have no encoding, and is
nothing we can anything do about in gnome-vfs.

In glib there are some functions for handling the encoding of filenames,
namely g_filename_to/from_utf8. These are mainly for displaying and
entering filenames in a UI, since the UI always uses utf8 for all
strings which might not be right for a filename. These functions use
G_BROKEN_FILENAMES and G_FILENAME_ENCODING env vars to determine what
encoding to use for the filenames. However, valid files can still have
names that are not in this encoding, and to be able to e.g. open or
rename such a file gnome-vfs must allow a uri point to it, and such a
uri would not be in the encoding specified by G_FILENAME_ENCODING (nor
would it necessarily be utf8).

You just have to be very careful about your string encodings. I'd
recommend using hex escapes when specifying a non-ascii string in C
source code.

 Alexander Larsson                                            Red Hat, Inc 
                   alexl redhat com    alla lysator liu se 
He's an underprivileged soccer-playing photographer searching for his wife's 
true killer. She's an orphaned extravagent museum curator from out of town. 
They fight crime! 

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