Re: Filename encoding in FileChooser
- From: Daniel Flemming <danflemming mac com>
- To: muppet <scott asofyet org>
- Cc: Gtk-Perl-List <gtk-perl-list gnome org>
- Subject: Re: Filename encoding in FileChooser
- Date: Thu, 12 Aug 2004 01:10:30 -0400 (EDT)
On Wed, 11 Aug 2004, muppet wrote:
On Wed, 2004-08-11 at 15:15, Daniel Flemming wrote:
Hmmm, that's interesting reading, and relevant, but it doesn't really
answer my question. :) I have a FileChooserDialog set to
GTK_FILE_CHOOSER_ACTION_SAVE, and I read its filename with a
get_filename method call after running it with a run method call.
What I want to know is, what encoding is put into the resulting
scalar (from the get_filename call)? I thought it was probably
Unicode because that's what gtk uses in general, and also the
resulting filenames kinda looked like Unicode. But I wanted to make
sure.
have you actually run into any problems, or are you just looking for
what's the right thing up front?
No problems, not yet. I'm actually kinda hoping it's Unicode; it would
make a Certain Idea I had easier to implement, maybe.
gtk_file_chooser_get_file_name() returns the result of
gtk_file_system_path_to_filename(), which invokes a vtable method;
choosing the GtkFileSystemUnix implementation, that function is
gtk_file_system_unix_path_to_filename(), which does this:
static gchar *
gtk_file_system_unix_path_to_filename (GtkFileSystem *file_system,
const GtkFilePath *path)
{
return g_strdup (gtk_file_path_get_string (path));
}
based on this reading, i would expect that the result of
gtk_file_chooser_get_filename() is in local encoding (the same as on
your disk, not utf8).
Hmmm, except that I can enter non-ASCII characters in a GtkFileChooser,
and they appear in what appears to be a multi-character encoding.
For example: benedictine (with accents over the first two e's, as in its
proper French usage) appears as b\303\251n\303\251dictine on the disk. I
don't know Unicode, but that's clearly a multi-byte encoding. And it looks
right when it's in the dialog, and also looks right when it's appearing in
a FileChooserDialog that's opening files.
--
GnuPG public key available from
http://homepage.mac.com/danflemming/gnupg_key.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]