#372 Bug for virus DSN + non English subject

open-duplicate
nobody
None
5
2009-03-31
2009-03-31
Curtis MacDuff
No

If Amavis is bouncing virus emails and a virus email comes through that has a Japanese subject (I tested with Japanese, I assume this same thing happens with other languages) then the subject will not be printed correctly in the DSN template.

The problem is the majority of email clients (found this behavior in Thunderbird and Outlook Express, didn't feel like testing beyond that) will base64 encode the subjects if they are in Japanese (again I would assume this happens for any non English language). Then the original subject ends up looking like this in the DSN email send back to the sender:
=?UTF-8?B?44Gu44Km44Kk44Or44K544OB44Kn44OD44Kv44Gr44Gm?=

To fix this it needs to be decoded, I did this in the marco_header_field subroutine but it might not be the best place for it. Anywise, before returning the string I added these lines:
sub macro_header_field {
#... unchanged code original in this sub ...
if(/^=\?[^\?]+\?B\?(.+)\?=/) {
$_ = decode_base64($1);
}
$_;
}

Anywise, having this code seems to work (when getting the DSN I get Japanese text instead of a bunch of gibberish).

Discussion

  • Curtis MacDuff
    Curtis MacDuff
    2009-03-31

    • status: open --> open-duplicate