Locale filenames to UTF8


recently I noticed that eog is broken with regards to filename conversion
from locale encoded filenames to UTF8.

My testcase is a filename with german umlauts. In this case
g_filename_to_utf8 returns NULL, while g_locale_to_utf8 works as expected
and returns a valid UTF8 string.

The code I use in eog is in libeog/eog-image.c: eog_image_get_caption:

if (priv->caption == NULL) {
  char *short_str;
  short_str = gnome_vfs_uri_extract_short_name (priv->uri);
  if (g_utf8_validate (short_str, -1, NULL)) {
    priv->caption = g_strdup (short_str);
  else {
    priv->caption = g_filename_to_utf8 (short_str, -1, NULL, NULL, NULL);
  g_free (short_str);

Nautilus seems to do some fancy stuff with the G_BROKEN_FILENAMES
env variable to determine how to transform this into UTF8. 

What are the differences between filename_to_utf8 and locale_to_utf8? What
is the right thing to do in eog? Can somebody enlighten me on this issue?

Thanks & regards,


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