From 44da5b863597e761df3545dc7ff02a9b53bbb13d Mon Sep 17 00:00:00 2001 From: Jake Petroules Date: Wed, 27 Dec 2017 12:42:26 -0800 Subject: Allow moc to handle Unicode output filenames on Windows with MSVC The C standard library functions cannot handle UTF-8 filenames. Instead, we need to use the wide-character versions which accept UTF-16 input. Task-number: QTBUG-65492 Change-Id: If4b3b4eeeec4f3bbb428b8f6b0311a65d01463b0 Reviewed-by: Thiago Macieira --- src/tools/moc/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp index 98cc9652ab..dfcc23f0d6 100644 --- a/src/tools/moc/main.cpp +++ b/src/tools/moc/main.cpp @@ -486,8 +486,8 @@ int runMoc(int argc, char **argv) // 3. and output meta object code if (output.size()) { // output file specified -#if defined(_MSC_VER) && _MSC_VER >= 1400 - if (fopen_s(&out, QFile::encodeName(output).constData(), "w")) +#if defined(_MSC_VER) + if (_wfopen_s(&out, reinterpret_cast(output.utf16()), L"w") != 0) #else out = fopen(QFile::encodeName(output).constData(), "w"); // create output file if (!out) -- cgit v1.2.3