GNOME Bugzilla – Bug 324150
gnome-print save filename as utf8 on non-utf8 when print to file
Last modified: 2006-10-31 10:42:52 UTC
setup: os: solaris 10 locale: non-utf8 locale,such as zh_CN.GB18030 steps to reproduce: 1) Login in non-utf8 locale, such as zh_CN.GB18030, Launch gedit, and choose 'File->Print' 2) Choose 'Print a PDF Document' and then choose one filename whose name contain multibyte characters, click "print" button result: 1) The file is saved on the disk, but the encoding of filename is utf8, so when you use 'ls -l' on gnome-terminal, you will get garbage.
Created attachment 56014 [details] [review] convert filename from utf8 to glib encoding
Comment on attachment 56014 [details] [review] convert filename from utf8 to glib encoding --- gp-transport-file.c.orig 2005-12-15 15:28:29.046100000 +0800 +++ gp-transport-file.c 2005-12-21 10:46:10.929985000 +0800 @@ -158,7 +158,11 @@ #if defined(G_OS_WIN32) && (defined(__MINGW32__) || defined _MSC_VER) tf->fd = open (tf->name, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, _S_IREAD | _S_IWRITE); #else - tf->fd = open (tf->name, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + gchar *sys_filename = NULL; + sys_filename = g_filename_from_utf8 ((const gchar*)tf->name, -1, NULL, NULL, NULL); + g_return_val_if_fail (sys_filename != NULL, GNOME_PRINT_ERROR_UNKNOWN); + tf->fd = open (sys_filename, O_CREAT | O_TRUNC | O_WRONLY | O_BINARY, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + g_free (sys_filename); #endif if (tf->fd < 0) {
Created attachment 56237 [details] [review] refine previous patch.
Could somebody evaluate and integrate the patch?
Created attachment 70931 [details] [review] update patch I updated the patch so it doesn't mix code and declarations.
Look good, is this going to be intgrated into 2.16 release candidate, Kjartan?
Commited. We'll get this into 2.17.x.
thanks, Kjartan! You are Da man :)