Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2700 from alexbruy/actions-encoding
convert stdout and stderr from actions to correct encoding (fix #13896)
  • Loading branch information
alexbruy committed Feb 5, 2016
2 parents 57b5eb9 + 7fc88c2 commit cb7d0fb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/core/qgsrunprocess.cpp
Expand Up @@ -23,6 +23,7 @@
#include "qgslogger.h"
#include "qgsmessageoutput.h"
#include <QProcess>
#include <QTextCodec>
#include <QMessageBox>

QgsRunProcess::QgsRunProcess( const QString& action, bool capture )
Expand Down Expand Up @@ -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>" );
Expand Down

0 comments on commit cb7d0fb

Please sign in to comment.