Skip to content
Permalink
Browse files

convert stdout and stderr to correct encoding (fix #13896)

  • Loading branch information
alexbruy committed Jan 20, 2016
1 parent 60816af commit 7fc88c26eaa4ec2e2bf880894eb770e6b4f584cf
Showing with 7 additions and 2 deletions.
  1. +7 −2 src/core/qgsrunprocess.cpp
@@ -23,6 +23,7 @@
#include "qgslogger.h"
#include "qgsmessageoutput.h"
#include <QProcess>
#include <QTextCodec>
#include <QMessageBox>

QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
@@ -90,15 +91,19 @@ void QgsRunProcess::die()

void QgsRunProcess::stdoutAvailable()
{
QString line( mProcess->readAllStandardOutput() );
QByteArray bytes( mProcess->readAllStandardOutput() );
QTextCodec *codec = QTextCodec::codecForLocale();
QString line( codec->toUnicode( bytes ) );

// Add the new output to the dialog box
mOutput->appendMessage( line );
}

void QgsRunProcess::stderrAvailable()
{
QString line( mProcess->readAllStandardError() );
QByteArray bytes( mProcess->readAllStandardOutput() );
QTextCodec *codec = QTextCodec::codecForLocale();
QString line( codec->toUnicode( bytes ) );

// Add the new output to the dialog box, but color it red
mOutput->appendMessage( "<font color=red>" + line + "</font>" );

0 comments on commit 7fc88c2

Please sign in to comment.
You can’t perform that action at this time.