Skip to content

Commit 539de03

Browse files
hartworktnyblom
authored andcommitted
Stop unintended re-encoding of author names from UTF-8 to ASCII
To see the bug in action, use an author map with umlauts, e.g. nickname = Hällo Wörld from UTF-8 <mail@example.org> and check "git log" after the conversion. What is happening? QByteArray "author" is first decoded as UTF-8 into a QString. That QString is passed to QByteArray::append(const QString &) which internally encodes the QString to ASCII byte data using QString::toAscii(). "git fast-import" expects UTF-8 input from us, so the original QByteArray with UTF-8 content is just what we need.
1 parent 4a1e11c commit 539de03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/repository.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ void Repository::Transaction::commitNote(const QByteArray &noteText, bool append
685685
QByteArray s("");
686686
s.append("commit refs/notes/commits\n");
687687
s.append("mark :" + QByteArray::number(maxMark + 1) + "\n");
688-
s.append("committer " + QString::fromUtf8(author) + " " + QString::number(datetime) + " +0000" + "\n");
688+
s.append("committer " + author + " " + QString::number(datetime) + " +0000" + "\n");
689689
s.append("data " + QString::number(message.length()) + "\n");
690690
s.append(message + "\n");
691691
s.append("N inline " + commitRef + "\n");

0 commit comments

Comments
 (0)