Page 1 of 1

Utf8 filenames on Windows with MinGW

Posted: 2014-06-23T01:41:03-07:00
by michalfapso
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.