summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2007-09-24 04:52:51 +0200
committermkanat%bugzilla.org <>2007-09-24 04:52:51 +0200
commit7c3069b273534b46fbc9b7745b0d48e68b6bf832 (patch)
tree9111e63a9c61460cb87918d13833b3493873c94f
parentb563c51151ed962673d52bd9834a03480efb34cb (diff)
downloadbugzilla-7c3069b273534b46fbc9b7745b0d48e68b6bf832.tar.gz
bugzilla-7c3069b273534b46fbc9b7745b0d48e68b6bf832.tar.xz
Bug 369835: email_in.pl should convert character encoding to utf8
Patch By Fedor Ezeev <fe@alterplast.ru> r=mkanat, a=mkanat
-rw-r--r--email_in.pl9
1 files changed, 9 insertions, 0 deletions
diff --git a/email_in.pl b/email_in.pl
index be9abadea..ea5082844 100644
--- a/email_in.pl
+++ b/email_in.pl
@@ -36,6 +36,7 @@ use Email::MIME;
use Email::MIME::Attachment::Stripper;
use Getopt::Long qw(:config bundling);
use Pod::Usage;
+use Encode qw(encode decode);
use Bugzilla;
use Bugzilla::Bug qw(ValidateBugID);
@@ -295,9 +296,17 @@ sub get_text_alternative {
my $body;
foreach my $part (@parts) {
my $ct = $part->content_type || 'text/plain';
+ my $charset = 'iso-8859-1';
+ if ($ct =~ /charset=([^;]+)/) {
+ $charset= $1;
+ }
debug_print("Part Content-Type: $ct", 2);
+ debug_print("Part Character Encoding: $charset", 2);
if (!$ct || $ct =~ /^text\/plain/i) {
$body = $part->body;
+ if (Bugzilla->params->{'utf8'}) {
+ $body = encode('UTF-8', decode($charset, $body));
+ }
last;
}
}