After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 326747 - g_filename_display_basename adds (invalid encoding)
g_filename_display_basename adds (invalid encoding)
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: general
2.8.x
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
: 103802 318280 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-01-12 17:22 UTC by Alberto Ruiz
Modified: 2008-10-13 00:29 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12



Description Alberto Ruiz 2006-01-12 17:22:38 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:
Comment 1 Matthias Clasen 2006-01-12 17:25:34 UTC
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.
Comment 2 Matthias Clasen 2006-01-12 20:32:35 UTC
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.
Comment 3 Behdad Esfahbod 2006-01-13 19:18:08 UTC
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.
Comment 4 Matthias Clasen 2006-01-13 19:23:22 UTC
The "question mark on black lozenge/oval" seems a pretty standard rendition
Comment 5 Alberto Ruiz 2006-01-13 19:59:18 UTC
That question mark is what mozilla/firefox uses for display unrecognized characters, so it seems a right choice.
Comment 6 Matthias Clasen 2006-01-16 15:20:03 UTC
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.
Comment 7 Nelson Benitez 2008-10-13 00:28:14 UTC
*** Bug 103802 has been marked as a duplicate of this bug. ***
Comment 8 Nelson Benitez 2008-10-13 00:29:54 UTC
*** Bug 318280 has been marked as a duplicate of this bug. ***