qt: On Windows, use UTF-8 when logging the error text
* lang/qt/src/debug.cpp (operator<<): On Windows, interpret the error text as UTF-8 instead of local 8-bit encoding. -- GnuPG-bug-id: 5960
This commit is contained in:
parent
278f92b189
commit
618fea9e20
@ -42,8 +42,14 @@
|
|||||||
|
|
||||||
QDebug operator<<(QDebug debug, const GpgME::Error &err)
|
QDebug operator<<(QDebug debug, const GpgME::Error &err)
|
||||||
{
|
{
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
// On Windows, we tell libgpg-error to return (translated) error messages as UTF-8
|
||||||
|
const auto errAsString = QString::fromUtf8(err.asString());
|
||||||
|
#else
|
||||||
|
const auto errAsString = QString::fromLocal8Bit(err.asString());
|
||||||
|
#endif
|
||||||
const bool oldSetting = debug.autoInsertSpaces();
|
const bool oldSetting = debug.autoInsertSpaces();
|
||||||
debug.nospace() << err.asString() << " (code: " << err.code() << ", source: " << err.source() << ")";
|
debug.nospace() << errAsString << " (code: " << err.code() << ", source: " << err.source() << ")";
|
||||||
debug.setAutoInsertSpaces(oldSetting);
|
debug.setAutoInsertSpaces(oldSetting);
|
||||||
return debug.maybeSpace();
|
return debug.maybeSpace();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user