Version: 1.4.95 (using KDE KDE 3.5.1) Installed from: Gentoo Packages Compiler: gcc 4.1.0 OS: Linux Load a image file from Win32 Fat partition, it said "Could not open /mnt/Pictures/My Photos/02_Disc/苏州/pict7539.jpg. Reason: Cannot create storage", but the image can be shown in the preview panel. System locale: zh_CN.UTF-8
Ah, yes I can confirm.
This is a problem with the tif and jpeg filters, not the magick filter, so it must be a bug in tif and jpeg. Cyrille, can you look at it? Reproducing is easy. Just open kcharselect, goto page 99, select any chinese character, copy it to the clipboard, and then type use that to copy the file to a file with a hanzi name. Opening in Krita gives exactly the error described.
SVN commit 518325 by berger: fix loading of jpeg, tiff and png with a chinese character (or any other utf8) in the name. (and fix saving as an extra free bonus) BUG:123495 M +4 -2 jpeg/kis_jpeg_converter.cc M +4 -2 png/kis_png_converter.cc M +4 -2 tiff/kis_tiff_converter.cc --- trunk/koffice/filters/krita/jpeg/kis_jpeg_converter.cc #518324:518325 @@ -25,6 +25,8 @@ #include <iccjpeg.h> } +#include <qfile.h> + #include <kapplication.h> #include <KoDocumentInfo.h> @@ -108,7 +110,7 @@ jpeg_create_decompress(&cinfo); // open the file - FILE *fp = fopen(uri.path().ascii(), "rb"); + FILE *fp = fopen(QFile::encodeName(uri.path()), "rb"); if (!fp) { return (KisImageBuilder_RESULT_NOT_EXIST); @@ -358,7 +360,7 @@ if (!uri.isLocalFile()) return KisImageBuilder_RESULT_NOT_LOCAL; // Open file for writing - FILE *fp = fopen(uri.path().ascii(), "wb"); + FILE *fp = fopen(QFile::encodeName(uri.path()), "wb"); if (!fp) { return (KisImageBuilder_RESULT_FAILURE); --- trunk/koffice/filters/krita/png/kis_png_converter.cc #518324:518325 @@ -22,6 +22,8 @@ #include <stdio.h> +#include <qfile.h> + #include <kapplication.h> #include <KoDocumentInfo.h> @@ -120,7 +122,7 @@ { kdDebug(41008) << "Start decoding PNG File" << endl; // open the file - FILE *fp = fopen(uri.path().ascii(), "rb"); + FILE *fp = fopen(QFile::encodeName(uri.path()), "rb"); if (!fp) { return (KisImageBuilder_RESULT_NOT_EXIST); @@ -427,7 +429,7 @@ if (!uri.isLocalFile()) return KisImageBuilder_RESULT_NOT_LOCAL; // Open file for writing - FILE *fp = fopen(uri.path().ascii(), "wb"); + FILE *fp = fopen(QFile::encodeName(uri.path()), "wb"); if (!fp) { return (KisImageBuilder_RESULT_FAILURE); --- trunk/koffice/filters/krita/tiff/kis_tiff_converter.cc #518324:518325 @@ -24,6 +24,8 @@ #include <config.h> #include LCMS_HEADER +#include <qfile.h> + #include <kapplication.h> #include <KoDocumentInfo.h> @@ -154,7 +156,7 @@ kdDebug(41008) << "Start decoding TIFF File" << endl; // Opent the TIFF file TIFF *image = 0; - if((image = TIFFOpen(uri.path().ascii(), "r")) == NULL){ + if((image = TIFFOpen(QFile::encodeName(uri.path()), "r")) == NULL){ kdDebug(41008) << "Could not open the file, either it doesn't exist, either it is not a TIFF : " << uri.path() << endl; if (image) TIFFClose(image); return (KisImageBuilder_RESULT_BAD_FETCH); @@ -604,7 +606,7 @@ // Open file for writing TIFF *image; - if((image = TIFFOpen(uri.path().ascii(), "w")) == NULL){ + if((image = TIFFOpen(QFile::encodeName(uri.path()), "w")) == NULL){ kdDebug(41008) << "Could not open the file for writting " << uri.path() << endl; TIFFClose(image); return (KisImageBuilder_RESULT_FAILURE);
How to use this patch? i can't apply it to krita source codes.
pasting from "--- trunk/koffice/filters/krita/jpeg/kis_jpeg_converter.cc #518324:518325" to the end of my message in a text file (called for instance "krita-chinese.patch" and patch -p1 <krita-chinese.patch in the koffice source directory should work, I don't think the code between svn and beta2 is that different to prevent the patch to be applied.