Subject: | Regain compatibility with Encode 2.02 and older |
Attached patch provides a trivial change that makes
HTTP::Message::decoded_content compatible with Encode 2.02 and older.
The charset names used in HTTP::Message were introduced as aliases in
Encode 2.03. The older charset names are still available and this patch
uses those instead of the newer ones.
Of course, the connoisseur will recognize and value the speedup gained
by removing unneeded calls to lc() and unneeded dashes:)
Cheers,
Subject: | libwww-perl-5.837-messageencode.diff |
--- lib/HTTP/Message.pm~ 2010-12-13 12:23:34.000000000 +0100
+++ lib/HTTP/Message.pm 2010-12-13 12:25:39.000000000 +0100
@@ -207,10 +207,10 @@ sub content_charset
# Unicode BOM
for ($$cref) {
return "UTF-8" if /^\xEF\xBB\xBF/;
- return "UTF-32-LE" if /^\xFF\xFE\x00\x00/;
- return "UTF-32-BE" if /^\x00\x00\xFE\xFF/;
- return "UTF-16-LE" if /^\xFF\xFE/;
- return "UTF-16-BE" if /^\xFE\xFF/;
+ return "UTF-32LE" if /^\xFF\xFE\x00\x00/;
+ return "UTF-32BE" if /^\x00\x00\xFE\xFF/;
+ return "UTF-16LE" if /^\xFF\xFE/;
+ return "UTF-16BE" if /^\xFE\xFF/;
}
if ($self->content_is_xml) {
@@ -357,13 +357,13 @@ sub decoded_content
}
if ($self->content_is_text || (my $is_xml = $self->content_is_xml)) {
- my $charset = lc(
+ my $charset =
$opt{charset} ||
$self->content_type_charset ||
$opt{default_charset} ||
$self->content_charset ||
"ISO-8859-1"
- );
+ ;
unless ($charset =~ /^(?:none|us-ascii|iso-8859-1)\z/) {
require Encode;
if (do{my $v = $Encode::VERSION; $v =~ s/_//g; $v} < 2.0901 &&