From e4e43352a8245fead46f72e37df1ccaac31d8941 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= <syntheticpp@gmx.net> Date: Sun, 10 Feb 2013 10:52:16 +0100 Subject: [PATCH] Git's config is UTF-8 encoded on Windows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 'git config' command returns UTF-8 strings if the encoding of the file was not hijacked by the user. Task-number: QTCREATORBUG-8696 Change-Id: I6181a26e56e2883ad5d46194f974e799bfd2aafb Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Peter Kümmel <syntheticpp@gmx.net> Reviewed-by: Tobias Hunger <tobias.hunger@digia.com> --- src/plugins/git/gitclient.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index 51a93e03361..b50601e5d3e 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -2399,9 +2399,11 @@ QString GitClient::readConfig(const QString &workingDirectory, const QStringList QByteArray outputText; QByteArray errorText; - if (fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText, false)) - return commandOutputFromLocal8Bit(outputText); - return QString(); + if (!fullySynchronousGit(workingDirectory, arguments, &outputText, &errorText, false)) + return QString(); + if (Utils::HostOsInfo::isWindowsHost()) + return QString::fromUtf8(outputText).remove(QLatin1Char('\r')); + return commandOutputFromLocal8Bit(outputText); } // Read a single-line config value, return trimmed -- GitLab