GNOME Bugzilla – Bug 676916
Filename garbled when you save .xcf.bz2 or .xcf.gz files using non-ASCII characters
Last modified: 2012-05-31 17:43:26 UTC
Has been garbled to check the file name in Windows Explorer after you save a file bz2 or gz files using non-ASCII characters. Yes there is a problem in Windows when using file-compressor plug-in. Can be read from the history of GIMP even though garbled. But from the drag & drop or "open" does not load with an error. Exsample: 1. Saved in "名称未設定.xcf.bz2". 2. Check the file name in Windows Explorer. 3. Has become "蜷咲ァー譛ェ險ュ螳・xcf.bz2" File name.
Which version of Windows is this about? > Yes there is a problem in Windows when using file-compressor plug-in. How is that related to the problem here? What do you mean by that?
Joji, does the same happen if you save an uncompressed XCF file?
Confirmed - file-compressor calls gzopen/BZ2_bzopen with the utf8-encoded filename, while these functions expect the codepage encoding (which means that they can't be used directly on Windows).
Created attachment 215116 [details] [review] Use g_open() and g_fopen() instead of libc I haven't tested this patch at all. It merely builds on Linux. No time for that right now. I'd appreciate if someone checks if it builds under win32. Specifically, I'm not sure if fcntl.h is available on win32 and if the macros to open() are accepted. I've used a number avoiding macros for the file mode bits as I think these are not available in the Windows environment.
If it works fine on linux, please push, that's the fastest ways of getting it fixed for windows.
Pushed to gimp-2-8 branch: * e608b47 file-compressor: Bug #676916 - Use g_open() and g_fopen() instead of libc Pushed to master: * 49d7b05 file-compressor: Bug #676916 - Use g_open() and g_fopen() instead of libc Whoever verifies it on Windows please resolve it :)
Created attachment 215255 [details] [review] proposed patch On Windows it does not work, you have to or | _O_BINARY to the 'flags' parameter passed to 'g_open' as, for example, in http://git.gnome.org/browse/gimp/tree/plug-ins/common/file-tiff-save.c?h=gimp-2-8#n679 Attaching a patch that I tested on Windows. If there is no objection, I'll push it.
Fixed in master and gimp-2-8 commit 321a113212957cb4608fc5e405528963e61e1479 Author: Massimo Valentini <mvalentini@src.gnome.org> Date: Thu May 31 19:35:21 2012 +0200 Bug 676916: Filename garbled when you save .xcf.bz2... or .xcf.gz files using non-ASCII characters and commit bf7fa23bebab3cb794c1422fcdf115363ec9ed49