In case we have a long utf-8 name the second line will contain UTF-8
code.
Here is an example:
From: =?UTF-8?q?K=C3=B6ry=20Maincent=20=28bla=20blou=20prout=20test=20?=
=?UTF-8?q?=29?= <kory.maincent@bootlin.com>
Date: Fri, 28 Nov 2025 10:57:00 +0100
Subject: [PATCH] checkpatch: Add support for long UTF-8 name
On this rare case checkpatch is returning an error due to UTF-8 code in
the name as it only decodes the From once the line is fully concatenated.
WARNING: From:/Signed-off-by: email name mismatch: 'From: "Köry Maincent
(bla blou prout test test=?UTF-8?q?=29?=" <kory.maincent@bootlin.com>'
!= 'Signed-off-by: Köry Maincent (bla blou prout test test)
<kory.maincent@bootlin.com>'
Decode each line instead to be sure we don't have UTF-8 code in the
email name check.
Reported-by: Jérémie Dautheribes <jeremie.dautheribes@bootlin.com>
Co-developed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>
---
scripts/checkpatch.pl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 92669904eecc7..98cc7f6fb8b5f 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -2979,11 +2979,13 @@ sub process {
# Check the patch for a From:
if (decode("MIME-Header", $line) =~ /^From:\s*(.*)/) {
$author = $1;
+ $author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
my $curline = $linenr;
while(defined($rawlines[$curline]) && ($rawlines[$curline++] =~ /^[ \t]\s*(.*)/)) {
- $author .= $1;
+ my $tmp = $1;
+ $tmp = encode("utf8", decode("MIME-Header", $tmp)) if ($tmp =~ /=\?utf-8\?/i);
+ $author .= $tmp;
}
- $author = encode("utf8", $author) if ($line =~ /=\?utf-8\?/i);
$author =~ s/"//g;
$author = reformat_email($author);
}
--
2.43.0