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 324150 - gnome-print save filename as utf8 on non-utf8 when print to file
gnome-print save filename as utf8 on non-utf8 when print to file
Status: RESOLVED FIXED
Product: gnome-print
Classification: Deprecated
Component: general
CVS
Other opensolaris
: Normal normal
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2005-12-15 08:20 UTC by yydzero
Modified: 2006-10-31 10:42 UTC
See Also:
GNOME target: ---
GNOME version: 2.13/2.14


Attachments
convert filename from utf8 to glib encoding (1.15 KB, patch)
2005-12-15 08:42 UTC, yydzero
none Details | Review
refine previous patch. (820 bytes, patch)
2005-12-21 02:49 UTC, yydzero
none Details | Review
update patch (1.35 KB, patch)
2006-08-15 10:39 UTC, Kjartan Maraas
none Details | Review

Description yydzero 2005-12-15 08:20:37 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.
Comment 1 yydzero 2005-12-15 08:42:45 UTC
Created attachment 56014 [details] [review]
convert filename from utf8 to glib encoding
Comment 2 yydzero 2005-12-21 02:46:57 UTC
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) {
Comment 3 yydzero 2005-12-21 02:49:57 UTC
Created attachment 56237 [details] [review]
refine previous patch.
Comment 4 Takao Fujiwara 2006-04-19 02:05:39 UTC
Could somebody evaluate and integrate the patch?
Comment 5 Kjartan Maraas 2006-08-15 10:39:44 UTC
Created attachment 70931 [details] [review]
update patch

I updated the patch so it doesn't mix code and declarations.
Comment 6 Ghee Teo 2006-08-18 14:35:14 UTC
Look good, is this going to be intgrated into 2.16 release candidate, Kjartan?
Comment 7 Kjartan Maraas 2006-10-30 11:55:56 UTC
Commited. We'll get this into 2.17.x.
Comment 8 Ghee Teo 2006-10-31 10:42:52 UTC
thanks, Kjartan! You are Da man :)