Commit 79e8f885 authored by Yuchen Deng's avatar Yuchen Deng Committed by Tobias Hunger

Git: Fix log encoding

We should using "i18n.logOutputEncoding" as we can.
In default, it should be 'utf-8'.

Change-Id: Ic5af2869e5fd5273a712f28e8e59149a4c2ef2b7
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent b612e9b1
......@@ -843,7 +843,14 @@ bool GitClient::synchronousLog(const QString &workingDirectory, const QStringLis
allArguments.append(arguments);
const bool rc = fullySynchronousGit(workingDirectory, allArguments, &outputText, &errorText);
if (rc) {
*output = commandOutputFromLocal8Bit(outputText);
QString encodingName = readConfigValue(workingDirectory, QLatin1String("i18n.logOutputEncoding"));
if (encodingName.isEmpty())
encodingName = QLatin1String("utf-8");
QTextCodec *codec = QTextCodec::codecForName(encodingName.toLocal8Bit());
if (codec)
*output = codec->toUnicode(outputText);
else
*output = commandOutputFromLocal8Bit(outputText);
} else {
const QString errorMessage = tr("Cannot obtain log of \"%1\": %2").
arg(QDir::toNativeSeparators(workingDirectory),
......
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