GNOME Bugzilla – Bug 674345
cssprovider: Make sure to print out file name in css warnings
Last modified: 2012-04-20 12:42:10 UTC
Warnings without a file name aren't super helpful: Gtk-WARNING **: Theme parsing error: (null):848:18: Not using units is deprecated. Assuming 'px'.
Created attachment 212308 [details] [review] cssprovider: Make sure to print out file name in css warnings * Use the file basename if display name returns %NULL
From the gio docs: The base name is a byte string (*not* UTF-8). It has no defined encoding or rules other than it may not contain zero bytes. If you want to use filenames in a user interface you should use the display name that you can get by requesting the G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME attribute with g_file_query_info(). So I suppose that patch is wrong. In fact, this looks like a bug in GResourceFile not providing the display name.
This isn't used in the interface. It's used in a g_warning. IMO it's unnecessary to use the display name here at all.
g_warning() requires UTF-8, no?
No. It correctly escapes invalid characters. g_warning ("\xF3\xF3\n"); Will print. WARNING **: \xf3\xf3
That's cool. I didn't know that. But are you sure this is not just glibc being awesome? Because looking at the code, it uses the standard printf machinery of the OS, and its specification (man 3 printf) says: The format string is a character string, beginning and ending in its initial shift state, if any. The format string is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to the output stream [...] For %s that same page says: The const char * argument is expected to be a pointer to an array of character type (pointer to a string). Characters from the array are written up to (but not including) a terminating null byte. So strictly speaking, that printf() implementation that your system is using is wrong.
Looks like g_log_default_handler uses the internal escape_string function to handle non-utf8 strings. Nice feature. glibc doesn't help out: printf ("\xF3\xF3\n"); produces garbage: �
Fixed in master and glib-2-32 branch.