# {{{ Convert the body
eval {
- $RT::Logger->debug("Converting '$charset' to '$enc' for ". $head->mime_type . " - ". $head->get('subject'));
+ $RT::Logger->debug("Converting '$charset' to '$enc' for ". $head->mime_type . " - ". ($head->get('subject') || 'Subjectless message'));
# NOTE:: see the comments at the end of the sub.
Encode::_utf8_off( $lines[$_] ) foreach ( 0 .. $#lines );
my $str = shift;
my $enc = shift;
-
- @_ = $str =~ m/([^=]*)=\?([^?]+)\?([QqBb])\?([^?]+)\?=([^=]*)/g;
-
+ @_ = $str =~ m/(.*?)=\?([^?]+)\?([QqBb])\?([^?]+)\?=([^=]*)/gc;
return ($str) unless (@_);
+ # add everything that hasn't matched to the end of the latest
+ # string in array this happen when we have 'key="=?encoded?="; key="plain"'
+ $_[-1] .= substr($str, pos $str);
+
$str = "";
while (@_) {
my ($prefix, $charset, $encoding, $enc_str, $trailing) =