]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Eml.pm
wwwstream: use parent.pm and no warnings
[public-inbox.git] / lib / PublicInbox / Eml.pm
index d2bd391554566d2e7939dfea36141e8660e013f5..1fecd41be9f4b1f2d11d4591918935ac9b1aba16 100644 (file)
@@ -237,7 +237,7 @@ sub mp_descend ($$) {
 sub each_part {
        my ($self, $cb, $arg, $once, $all) = @_;
        my $p = mp_descend($self, $once // 0) or
-                                       return $cb->([$self, 0, 0], $arg);
+                                       return $cb->([$self, 0, 1], $arg);
 
        $cb->([$self, 0, 0], $arg) if ($all || $self->{-call_cb}); # rare
 
@@ -368,9 +368,12 @@ sub header_str_set {
        my ($self, $name, @vals) = @_;
        for (@vals) {
                next unless /[^\x20-\x7e]/;
-               utf8::encode($_); # to octets
                # 39: int((75 - length("Subject: =?UTF-8?B?".'?=') ) / 4) * 3;
-               s/(.{1,39})/'=?UTF-8?B?'.encode_base64($1, '').'?='/ges;
+               s/(.{1,39})/
+                       my $x = $1;
+                       utf8::encode($x); # to octets
+                       '=?UTF-8?B?'.encode_base64($x, '').'?='
+               /xges;
        }
        header_set($self, $name, @vals);
 }