GNOME Bugzilla – Bug 326747
g_filename_display_basename adds (invalid encoding)
Last modified: 2008-10-13 00:29:54 UTC
Please describe the problem: nautilus (for example) shows " (invalid encoding)" string as the display name for a file, so, when I edit the file I get that string shown in the edit field. I filed that as a nautilus bug, http://bugzilla.gnome.org/show_bug.cgi?id=103802 and talking with mantainers they told me that was better to solve this from glib. The advise should be done with some flag, or at least, there must be an equivalent function that don't append that string. Steps to reproduce: Get an invalid encoding filename char and look at the result after doing: g_filename_display_basename(string); Actual results: (invalid encoding) string is appended after the displayed name on the string resulted Expected results: take that advice using flags Does this happen every time? yes Other information:
One idea: instead of replacing by ? and appending (invalid encoding), we could replace by 0xFFFD REPLACEMENT CHARACTER. nautilus could then check for the presence of that character to find out if the encoding was invalid. I have to admit that the 0xFFFD glyph in Bitstream Vera looks a bit odd, but the one in Fixed is very nice.
Actually I'm hearing that the replacement character in vera is just broken, and the dejavu fonts have a nice one, so maybe this is an option after all.
Yeah, the replacement character is rarely found in fonts on free desktops. That's a shame. Pango should take care of drawing a fallback for it if you ask me. The problem is that there's no definite glyph for that character.
The "question mark on black lozenge/oval" seems a pretty standard rendition
That question mark is what mozilla/firefox uses for display unrecognized characters, so it seems a right choice.
2006-01-16 Matthias Clasen <mclasen@redhat.com> Fix bug 326747, Alberto Ruiz: * glib/gconvert.c (make_valid_utf8): Change this function to replace unknown characters by the Unicode replacement character instead of '?', and don't append "(invalid encoding)". (g_filename_display_name, g_filename_display_basename): Document how to determine if the filename was in an invalid encoding.
*** Bug 103802 has been marked as a duplicate of this bug. ***
*** Bug 318280 has been marked as a duplicate of this bug. ***