# 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();
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': $@";
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
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