Skip to content

Commit cb7d0fb

Browse files
committed
Merge pull request #2700 from alexbruy/actions-encoding
convert stdout and stderr from actions to correct encoding (fix #13896)
2 parents 57b5eb9 + 7fc88c2 commit cb7d0fb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/core/qgsrunprocess.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "qgslogger.h"
2424
#include "qgsmessageoutput.h"
2525
#include <QProcess>
26+
#include <QTextCodec>
2627
#include <QMessageBox>
2728

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

9192
void QgsRunProcess::stdoutAvailable()
9293
{
93-
QString line( mProcess->readAllStandardOutput() );
94+
QByteArray bytes( mProcess->readAllStandardOutput() );
95+
QTextCodec *codec = QTextCodec::codecForLocale();
96+
QString line( codec->toUnicode( bytes ) );
9497

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

99102
void QgsRunProcess::stderrAvailable()
100103
{
101-
QString line( mProcess->readAllStandardError() );
104+
QByteArray bytes( mProcess->readAllStandardOutput() );
105+
QTextCodec *codec = QTextCodec::codecForLocale();
106+
QString line( codec->toUnicode( bytes ) );
102107

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

0 commit comments

Comments
 (0)