From 60d656594df09d476cd67e0f44cda1cf38720793 Mon Sep 17 00:00:00 2001 From: Dimitriy Ryazantcev Date: Wed, 21 Nov 2012 00:56:04 +0200 Subject: [PATCH 5/5] Azoth SHX: Win32 locale bug fixed. Maybe working only for Russian locale. --- src/plugins/azoth/plugins/shx/shx.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/azoth/plugins/shx/shx.cpp b/src/plugins/azoth/plugins/shx/shx.cpp index b57f145..f7fdb0d 100644 --- a/src/plugins/azoth/plugins/shx/shx.cpp +++ b/src/plugins/azoth/plugins/shx/shx.cpp @@ -18,6 +18,7 @@ #include "shx.h" #include +#include #include #include #include "xmlsettingsmanager.h" @@ -112,12 +113,20 @@ namespace SHX << proc; return; } - +#ifdef Q_OS_WIN32 + auto *codec = QTextCodec::codecForName("CP866"); // fixme: only valid for Russian locale. + auto out = codec->toUnicode (proc->readAllStandardOutput ()); +#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 (codec->toUnicode (err)) + "\n"); +#else out.prepend (tr ("Error: %1").arg (QString::fromUtf8 (err)) + "\n"); +#endif QMetaObject::invokeMethod (Process2Chat_.take (proc), "prepareMessageText", -- 1.7.11.msysgit.1