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 <Friedemann.Kleint@qt.io>
This commit is contained in:
parent
188501fe27
commit
a77c159044
@ -65,7 +65,7 @@ static inline bool shellExecute(const QUrl &url)
|
|||||||
nullptr, nullptr, SW_SHOWNORMAL));
|
nullptr, nullptr, SW_SHOWNORMAL));
|
||||||
// ShellExecute returns a value greater than 32 if successful
|
// ShellExecute returns a value greater than 32 if successful
|
||||||
if (result <= 32) {
|
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 false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -104,7 +104,7 @@ static inline bool launchMail(const QUrl &url)
|
|||||||
{
|
{
|
||||||
QString command = mailCommand();
|
QString command = mailCommand();
|
||||||
if (command.isEmpty()) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
//Make sure the path for the process is in quotes
|
//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);
|
si.cb = sizeof(si);
|
||||||
if (!CreateProcess(nullptr, reinterpret_cast<wchar_t *>(const_cast<ushort *>(command.utf16())),
|
if (!CreateProcess(nullptr, reinterpret_cast<wchar_t *>(const_cast<ushort *>(command.utf16())),
|
||||||
nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) {
|
nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) {
|
||||||
qErrnoWarning("Unable to launch '%s'", qPrintable(command));
|
qErrnoWarning("Unable to launch '%ls'", qUtf16Printable(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CloseHandle(pi.hProcess);
|
CloseHandle(pi.hProcess);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user