]> Sergey Matveev's repositories - public-inbox.git/commit
eml: header_str_set: correctly encode UTF-8 headers
authorEric Wong <e@yhbt.net>
Sun, 28 Jun 2020 07:14:40 +0000 (07:14 +0000)
committerEric Wong <e@yhbt.net>
Sun, 28 Jun 2020 18:35:47 +0000 (18:35 +0000)
commit52e37476e8e62e8e54104d9a2abcf2a86d1d1a32
tree45b30d09fdf06c5baf475771d6e2c825abf14c50
parent0d62ec0906ebdb4e9358ccb1c0d41a30f20711cf
eml: header_str_set: correctly encode UTF-8 headers

Apparently, using $1 from an octet string still results in a
multi-byte string.  Thus we need to perform utf8::encode after
the regexp character match to ensure wide characters don't get
passed to encode_base64.

This fixes a bug in which caused -watch to crash when using
PublicInbox::Filter::SubjectTag to remove "[list prefix]"
tags from Subject: lines.

I only found this bug because the proposed -watch updates for
NNTP/IMAP support introduced a possible bug which triggered a
full rescan of old archives:

  https://public-inbox.org/meta/20200627100400.9871-1-e@yhbt.net/
lib/PublicInbox/Eml.pm
t/filter_subjecttag.t