From a77c159044ce54fbdabaef088290771143ca5c2c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 26 Jul 2020 22:30:50 -0700 Subject: QWindowsServices: ungarble the URL QUrl::toString always encodes as UTF-8, regardless of what the local encoding is. So this produces garbage on Windows (and any non-UTF-8 system, but those don't exist any more outside of Windows, by definition). So use %ls to keep the UTF-16. Task-number: QTBUG-85745 Pick-to: 5.15 Change-Id: Iea47e0f8fc8b40378df7fffd162584f98e5bd633 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsservices.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/plugins/platforms/windows') diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 6a2708ee26..09ae55cd99 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -65,7 +65,7 @@ static inline bool shellExecute(const QUrl &url) nullptr, nullptr, SW_SHOWNORMAL)); // ShellExecute returns a value greater than 32 if successful if (result <= 32) { - qWarning("ShellExecute '%s' failed (error %s).", qPrintable(url.toString()), qPrintable(QString::number(result))); + qWarning("ShellExecute '%ls' failed (error %zu).", qUtf16Printable(url.toString()), result); return false; } return true; @@ -104,7 +104,7 @@ static inline bool launchMail(const QUrl &url) { QString command = mailCommand(); if (command.isEmpty()) { - qWarning("Cannot launch '%s': There is no mail program installed.", qPrintable(url.toString())); + qWarning("Cannot launch '%ls': There is no mail program installed.", qUtf16Printable(url.toString())); return false; } //Make sure the path for the process is in quotes @@ -129,7 +129,7 @@ static inline bool launchMail(const QUrl &url) si.cb = sizeof(si); if (!CreateProcess(nullptr, reinterpret_cast(const_cast(command.utf16())), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) { - qErrnoWarning("Unable to launch '%s'", qPrintable(command)); + qErrnoWarning("Unable to launch '%ls'", qUtf16Printable(command)); return false; } CloseHandle(pi.hProcess); -- cgit v1.2.3