Utf8 filenames on Windows with MinGW
Posted: 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:
to this:
...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:
So the only problem was that ImageMagick compiled with MinGW used fopen() instead of _wfopen(). It probably worked well with MSVC compiler.
Code: Select all
#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__)
Code: Select all
#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__)
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());