
Hi All, I had a small problem with an email subject in UTF8. So I fixed and would like to submit back a diff. first of all it was not encoded properly since encode_mimewords wants a bytes an not widechar string as an input. And second encode_mimewords eats a space when it encodes so allwordsaregluedtogheter after you encode it, so I added space to be included in the regexp. Boris./ --- /home/xeon/soft/otrss/Kernel/System/Email.pm Wed Jan 19 22:06:25 2005 +++ /home/xeon/soft/otrs/Kernel/System/Email.pm Sat Aug 27 21:15:12 2005 @@ -224,7 +224,7 @@ # do some encode foreach (qw(From To Cc Bcc Subject)) { if ($Header{$_} && $Param{Charset}) { - $Header{$_} = encode_mimewords($Header{$_}, Charset => $Param{Charset}) || ''; + $Header{$_} = encode_mimewords(Encode::encode($Param {Charset},$Header{$_}), Charset => $Param{Charset}) || ''; } } $Header{'X-Mailer'} = $Self->{ConfigObject}->Get('Product')." Mail Service (".$Self->{ConfigObject}->Get('Version').")"; --- /home/xeon/soft/otrss/Kernel/cpan-lib/MIME/Words.pm Tue Feb 15 16:43:51 2005 +++ /home/xeon/soft/otrs/Kernel/cpan-lib/MIME/Words.pm Sun Sep 4 17:15:56 2005 @@ -117,7 +117,7 @@ # almost, but not exactly, quoted-printable. :-P sub _encode_Q { my $str = shift; - $str =~ s{([_\?\=$NONPRINT])}{sprintf("=%02X", ord($1))}eog; + $str =~ s{([ _\?\=$NONPRINT])}{sprintf("=%02X", ord($1))}eog; $str; } @@ -310,7 +310,7 @@ ### We limit such words to 18 characters, to guarantee that the ### worst-case encoding give us no more than 54 + ~10 < 75 characters my $word; - $rawstr =~ s{([a-zA-Z0-9\x7F-\xFF]{1,18})}{ ### get next "word" + $rawstr =~ s{([a-zA-Z0-9\x7F-\xFF]+\s*)}{ ### get next "word" $word = $1; (($word !~ /[$NONPRINT]/o) ? $word ### no unsafe chars
participants (1)
-
Boris Bliznioukov