From 1d60c609a05b60c2f6164cf91a8a5c057011b3b0 Mon Sep 17 00:00:00 2001 From: Dimitriy Ryazantcev Date: Wed, 21 Nov 2012 00:56:04 +0200 Subject: [PATCH] Azoth SHX: Win32 locale bug fixed. --- src/plugins/azoth/plugins/shx/shx.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plugins/azoth/plugins/shx/shx.cpp b/src/plugins/azoth/plugins/shx/shx.cpp index b57f145..df68887 100644 --- a/src/plugins/azoth/plugins/shx/shx.cpp +++ b/src/plugins/azoth/plugins/shx/shx.cpp @@ -94,7 +94,7 @@ namespace SHX this, SLOT (handleFinished ())); #ifdef Q_OS_WIN32 - proc->start ("cmd.exe", QStringList () << "/C" << text); + proc->start ("cmd.exe", QStringList () << "/U" << "/C" << text); #else proc->start ("/bin/sh", { "-c", text }); #endif @@ -112,12 +112,19 @@ namespace SHX << proc; return; } - +#ifdef Q_OS_WIN32 + auto out = QString::fromUtf16 (reinterpret_cast (proc->readAllStandardOutput ().constData ())); +#else auto out = QString::fromUtf8 (proc->readAllStandardOutput ()); +#endif const auto& err = proc->readAllStandardError (); if (!err.isEmpty ()) +#ifdef Q_OS_WIN32 + out.prepend (tr ("Error: %1").arg (QString::fromUtf16 (reinterpret_cast (err.constData ()))) + "\n"); +#else out.prepend (tr ("Error: %1").arg (QString::fromUtf8 (err)) + "\n"); +#endif QMetaObject::invokeMethod (Process2Chat_.take (proc), "prepareMessageText", -- 1.7.11.msysgit.1