From 38d0e8f6777f6e80e85334b0f39e968e6b0ba38c Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 6 Sep 2012 11:28:11 -0700 Subject: [PATCH] use Text::Iconv instead of decode($charset,$data) --- Debbugs/MIME.pm | 7 ++++++- debian/control | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Debbugs/MIME.pm b/Debbugs/MIME.pm index 481be7bf..9073df10 100644 --- a/Debbugs/MIME.pm +++ b/Debbugs/MIME.pm @@ -58,6 +58,7 @@ use List::MoreUtils qw(apply); # for decode_rfc1522 use MIME::WordDecoder qw(); use Encode qw(decode encode encode_utf8 decode_utf8 is_utf8); +use Text::Iconv; # for encode_rfc1522 use MIME::Words qw(); @@ -235,10 +236,14 @@ sub convert_to_utf8 { my ($data, $charset) = @_; # raw data just gets returned (that's the charset WordDecorder # uses when it doesn't know what to do) + return $data if not defined $data; return $data if $charset eq 'raw' or is_utf8($data,1); my $result; eval { - $result = decode($charset,$data); + my $converter = Text::Iconv->new($charset,"utf-8") or + die "Unable to create converter for charset '$charset'"; + $result = decode_utf8($converter->convert($data)); + die "Error while converting" if not defined $converter->retval() or not defined $result; }; if ($@) { warn "Unable to decode charset; '$charset' and '$data': $@"; diff --git a/debian/control b/debian/control index ee365efd..8d143289 100644 --- a/debian/control +++ b/debian/control @@ -13,7 +13,7 @@ Build-Depends-Indep: libparams-validate-perl, libhttp-server-simple-perl, libtest-www-mechanize-perl, libmail-rfc822-address-perl, libsafe-hole-perl, libuser-perl, libconfig-simple-perl, libtest-pod-perl, liblist-moreutils-perl, - libtext-template-perl + libtext-template-perl, libtext-iconv-perl Homepage: http://wiki.debian.org/Teams/Debbugs Package: debbugs @@ -39,7 +39,7 @@ Depends: ${perl:Depends}, libmailtools-perl, ed, libmime-tools-perl, libio-stringy-perl, libmldbm-perl, liburi-perl, libsoap-lite-perl, libcgi-simple-perl, libparams-validate-perl, libtext-template-perl, libsafe-hole-perl, libmail-rfc822-address-perl, liblist-moreutils-perl, - libtext-template-perl + libtext-template-perl, libtext-iconv-perl Section: perl Description: modules used by the active Debian BTS Debian has a bug tracking system which files details of bugs reported by -- 2.39.5