diff --git a/lang/qt/src/debug.cpp b/lang/qt/src/debug.cpp index b563ac0c..2f6d200b 100644 --- a/lang/qt/src/debug.cpp +++ b/lang/qt/src/debug.cpp @@ -42,8 +42,14 @@ 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(); - debug.nospace() << err.asString() << " (code: " << err.code() << ", source: " << err.source() << ")"; + debug.nospace() << errAsString << " (code: " << err.code() << ", source: " << err.source() << ")"; debug.setAutoInsertSpaces(oldSetting); return debug.maybeSpace(); }