Use utf8 in gnupgprocesscommands

On windows with the GUI and Console Codepages ::fromLocal8bit
is not reliable as GnuPG might use a different 8bit codepage.
This way we tell gnupg to use utf8 and expect it in turn.
parent d7dc3062
......@@ -158,7 +158,7 @@ void GenRevokeCommand::doStart()
connect(proc, &QProcess::readyReadStandardOutput,
this, [proc] () {
while (proc->canReadLine()) {
const QString line = QString::fromLocal8Bit(proc->readLine()).trimmed();
const QString line = QString::fromUtf8(proc->readLine()).trimmed();
// Command-fd is a stable interface, while this is all kind of hacky we
// are on a deadline :-/
if (line == QStringLiteral("[GNUPG:] GET_BOOL gen_revoke.okay")) {
......
......@@ -271,6 +271,8 @@ void GnuPGProcessCommand::doStart()
d->process.setArguments(d->arguments);
// Historically code using this expects arguments first to be the program.
d->arguments.prepend(QLatin1String("utf-8"));
d->arguments.prepend(QLatin1String("--display-charset"));
d->arguments.prepend(d->process.program());
d->process.start();
......@@ -340,12 +342,12 @@ void GnuPGProcessCommand::Private::slotProcessReadyReadStandardError()
while (ba.endsWith('\n') || ba.endsWith('\r')) {
ba.chop(1);
}
message(QString::fromLocal8Bit(ba.constData(), ba.size()));
message(QString::fromUtf8(ba.constData(), ba.size()));
}
QString GnuPGProcessCommand::errorString() const
{
return QString::fromLocal8Bit(d->errorBuffer);
return QString::fromUtf8(d->errorBuffer);
}
void GnuPGProcessCommand::setIgnoresSuccessOrFailure(bool ignores)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment