GNOME Bugzilla – Bug 102968
New folder's file encoding problem in GB18030 locales
Last modified: 2004-12-22 21:47:04 UTC
On Solaris zh_CN.GB18030 and zh_CN.GBK locales, new folder's is created with a garbled name when G_BROKEN_FILENAMES is set to TRUE. This is because _("untitled folder") is localized to UTF-8's string, and when this will be given to the followings in nautilus_file_get_display_name_nocopy(), broken_filenames = have_broken_filenames (); if (broken_filenames || !g_utf8_validate (name,\ -1, NULL)) { utf8_name = g_locale_to_utf8 (name, -1,\ NULL, NULL, NULL); Here, the "name" is _("untitled folder") so is already UTF-8's, but due to "broken_filenames ||" , it is given to g_locale_to_utf8().
Created attachment 13450 [details] [review] do coverition to UTF-8 when both conditions are met.
Mark it "HIGH" as the patch's attached.
*** This bug has been marked as a duplicate of 90154 ***
This patch is wrong. If G_BROKEN_FILENAMES is true we shouldn't generate a utf8 filename for the new folder, but instead use the current locale to name it.
The patch was first made like yours - but was not sure if non UTF-8 string is allowed to pass gnome_vfs_uri_append_file_name ().
gnome_vfs_uri_append_file_name correctly escapes the filename as is required for the uri, and uris are not inherently in any specific encoding. They certainly don't have to mbe utf8, that would mean you couldn't use gnome-vfs to read files if G_BROKEN_FILENAMES were set.