what is the encoding of returned string of gnome_file_entry_get_full_path()?



Hi guys,

I newly compiled the libgnomeui cvs, and when I run libgnomeui/test-gnome/test-gnome, I found below bug:

  1) run test-gnome which under test-gnome directory of libgnomeui
  2) click 'pixmap entry', then 'Pixmap Entry' dialog popup
3) click 'Browse' Button, and select one picture file whose filename is non-utf8 encoded

  result:
  1) The picture can not display on preview area.

I run these steps on zh_CN.GB18030( one popular locale in China ) on solaris.

  Then I have a quick view on the source code, and found that:

refresh_preview() use gnome_file_entry_get_full_path() to get the picture file full path, and gnome_file_entry_get_full_path() will return the path in utf8 encoding, and then use gdk_pixbuf_new_from_file() to create pixbuf. As a result, gdk_pixbuf_new_from_file() can't find this utf8-encoded file on disk, because the filename on disk it gb18030 encoded, so can't preview picture file.

The fix is pretty simple, we can use g_filename_from_utf8() to convert utf8 encoded filename to Glib encoded filename.

What I wondering is that where we shoud put g_filename_from_utf8() in? it should in refresh_preview() or gnome_file_entry_get_full_path()?

If in refresh_preview(), then I guess we should modify all gnome codes where call gnome_file_entry_get_full_path(). So I think it will be more better if we fix it in gnome_file_entry_get_full_path(), just like gtk_file_selection_get_filename() which return the selected filename in the Glib filename encoding.

  How do you think? any suggestions are welcome!

I don't know if this alias is suitable for this or not, I hope this is the right one.

Regards,
Yandong



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