From: Jerry D. Hedden Date: Mon, 28 Jan 2008 10:19:26 +0000 (-0500) Subject: Fix uc/lc warnings in CGI.pm X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=89cc892864c36df27a5c1a9f6ff883dd1dab775c;p=p5sagit%2Fp5-mst-13.2.git Fix uc/lc warnings in CGI.pm From: "Jerry D. Hedden" Message-ID: <1ff86f510801280719w4d56807esd8318bc6d0eadcdd@mail.gmail.com> p4raw-id: //depot/perl@33094 --- diff --git a/lib/CGI.pm b/lib/CGI.pm index 6d5ddc9..f6fe9c9 100644 --- a/lib/CGI.pm +++ b/lib/CGI.pm @@ -1837,7 +1837,7 @@ sub startform { my($method,$action,$enctype,@other) = rearrange([METHOD,ACTION,ENCTYPE],@p); - $method = $self->escapeHTML(lc($method) || 'post'); + $method = $self->escapeHTML(($method) ? lc($method) : 'post'); $enctype = $self->escapeHTML($enctype || &URL_ENCODED); if (defined $action) { $action = $self->escapeHTML($action); @@ -2200,9 +2200,11 @@ sub escapeHTML { else { $toencode =~ s{"}{"}gso; } - my $latin = uc $self->{'.charset'} eq 'ISO-8859-1' || - uc $self->{'.charset'} eq 'WINDOWS-1252'; - if ($latin) { # bug in some browsers + # Handle bug in some browsers with Latin charsets + if ($self->{'.charset'} && + (uc($self->{'.charset'}) eq 'ISO-8859-1' || + uc($self->{'.charset'}) eq 'WINDOWS-1252')) + { $toencode =~ s{'}{'}gso; $toencode =~ s{\x8b}{‹}gso; $toencode =~ s{\x9b}{›}gso;