Utf8 filenames on Windows with MinGW

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
michalfapso
Posts: 3
Joined: 2014-06-16T07:10:21-07:00
Authentication code: 6789

Utf8 filenames on Windows with MinGW

Post by michalfapso » 2014-06-23T01:41:03-07:00

Hi everyone, first I would like to thank you all for working on ImageMagick! We use it for PSD load/save in our application and we found out that it has problems with using non-ascii filenames. The problem was in magick/utility-private.h in fopen_utf8(). When we changed:

Code: Select all

#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
to this:

Code: Select all

#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__)
...saving utf8 filenames started to work well. I don't have Cygwin installed here, but maybe it has to be also removed from the ifdef condition. Here is my Qt code:

Code: Select all

QString filename = QFileDialog::getSaveFileName();
QList<Magick::Image> out; // out layers
// Fill out list with images...
Magick::writeImages(out.begin(), out.end(), filename.toUtf8().data());
So the only problem was that ImageMagick compiled with MinGW used fopen() instead of _wfopen(). It probably worked well with MSVC compiler.

Post Reply