Bug #869 » 0005-Azoth-SHX-Win32-locale-bug-fixed.-Maybe-working-only.patch
| src/plugins/azoth/plugins/shx/shx.cpp | ||
|---|---|---|
|
#include "shx.h"
|
||
|
#include <QProcess>
|
||
|
#include <QTextCodec>
|
||
|
#include <QtDebug>
|
||
|
#include <xmlsettingsdialog/xmlsettingsdialog.h>
|
||
|
#include "xmlsettingsmanager.h"
|
||
| ... | ... | |
|
<< 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",
|
||