about summary refs log tree commit homepage
diff options
context:
space:
mode:
-rw-r--r--lib/PublicInbox/Smsg.pm3
-rw-r--r--t/psgi_search.t6
2 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/Smsg.pm b/lib/PublicInbox/Smsg.pm
index aaf88f35..62cb951e 100644
--- a/lib/PublicInbox/Smsg.pm
+++ b/lib/PublicInbox/Smsg.pm
@@ -105,6 +105,9 @@ sub populate {
                 # to protect git and NNTP clients
                 $val =~ tr/\0\t\n/   /;
 
+                # rare: in case headers have wide chars (not RFC2047-encoded)
+                utf8::decode($val);
+
                 # lower-case fields for read-only stuff
                 $self->{lc($f)} = $val;
 
diff --git a/t/psgi_search.t b/t/psgi_search.t
index 2d12ba6a..5d537363 100644
--- a/t/psgi_search.t
+++ b/t/psgi_search.t
@@ -28,8 +28,10 @@ my $im = $ibx->importer(0);
 my $digits = '10010260936330';
 my $ua = 'Pine.LNX.4.10';
 my $mid = "$ua.$digits.2460-100000\@penguin.transmeta.com";
+
+# n.b. these headers are not properly RFC2047-encoded
 my $mime = PublicInbox::Eml->new(<<EOF);
-Subject: test
+Subject: test Ævar
 Message-ID: <$mid>
 From: Ævar Arnfjörð Bjarmason <avarab\@example>
 To: git\@vger.kernel.org
@@ -102,6 +104,8 @@ test_psgi(sub { $www->call(@_) }, sub {
                 'subject-less message linked from "/$INBOX/"');
         like($html, qr/\bhref="blank-subject[^>]+>\(no subject\)</,
                 'blank subject message linked from "/$INBOX/"');
+        like($html, qr/test &#198;var/,
+                "displayed Ævar's name properly in topic view");
 
         $res = $cb->(GET('/test/?q=tc:git'));
         like($html, qr/\bhref="no-subject-at-all[^>]+>\(no subject\)</,