]> Sergey Matveev's repositories - public-inbox.git/commit
eml: header_raw converts octets to Perl UTF-8
authorEric Wong <e@80x24.org>
Thu, 24 Nov 2022 21:31:55 +0000 (21:31 +0000)
committerEric Wong <e@80x24.org>
Sat, 26 Nov 2022 08:09:58 +0000 (08:09 +0000)
commit5198c976ce8b1954f0f76a0da152cc434411f147
tree4ebf02230520d7526a14f194e50793ff07d3e32e
parent2bd8f48268ac24a4d3cac326a89099639ae1d170
eml: header_raw converts octets to Perl UTF-8

This fixes the display of raw (non-RFC 2047) names and subjects
in HTML message views.

SMTPUTF8 (RFC 6531) allows raw UTF-8 in headers without RFC 2047
encoding, so let Perl handle it as a character sequence for the
rest of our consumers.  Thus, the old special case in
PublicInbox::Smsg->populate is no longer necessary and gone.

The one regression notice so far (and fixed here) is compressed
IMAP envelope responses still needs raw bytes since the zlib
wrapper is designed for octets, not Perl UTF-8 chars.  Thus we
reverse utf8::decode with utf8::encode in PublicInbox::IMAP::_esc.

->header_set also forces encoding to bytes, since all existing
callers would either be dealing with ->header_raw results or
be RFC-2047-encoded anyways.

Reindexing is not necessary with this change due to the prior
PublicInbox::Smsg->populate special case.

Reported-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org>
Link: https://public-inbox.org/meta/20221124153715.3nenjpjzj43vqxr2@meerkat.local/
lib/PublicInbox/Eml.pm
lib/PublicInbox/IMAP.pm
lib/PublicInbox/Smsg.pm
t/imapd.t
t/psgi_search.t