Thorsten Glaser <t...@mirbsd.de> writes: > (sid)$ printf '%s' 'Subject: UNNAMED PROJECT branch bnewplus updated. > f9dfb215c29bc17b5ca12c0e8bb509aa4949787e' | perl -C7 -0777 -Mutf8 -MEncode -e > "print encode('MIME-Q', <>);"; echo > =?UTF-8?Q?Subject=3A_UNNAMED_PROJECT_branch_bnewplus_updated=2E_f9dfb215c?= > =?UTF-8?Q?29bc17b5ca12c0e8bb509aa4949787e?=
This doesn't directly address the rest of your bug report, but I'm fairly sure that including the email header in the text you're encoding is a bug in your code. RFC 2047 encoding is defined on a string, and the encoder has no way of knowing that the initial "Subject: " is magical and should be treated not as part of the string. It could well be part of the content of the header field. Regardless of the rest of the issues here with excessive encoding, your code should be encoding the contents of the field and then separately adding the header field name. This happens to accidentally work if the encoding reproduces pure ASCII words in the output text without encoding them, but it's technically incorrect because it's not valid in the email format to encode the header field name using RFC 2047 encoding. -- Russ Allbery (r...@debian.org) <http://www.eyrie.org/~eagle/>