Subject: | escapeHTML() output not affected by charset |
Date: | Sun, 12 May 2013 12:06:22 -0400 |
To: | bug-CGI [...] rt.cpan.org |
From: | Peter Baranyi <peter.baranyi [...] gmail.com> |
Hi,
The documentation at
http://search.cpan.org/dist/CGI/lib/CGI.pm#AUTOESCAPING_HTML says
about the escapeHTML function:
If you manually change the charset, either by calling the charset()
method explicitly or by passing a -charset argument to header(), then
all characters will be replaced by their numeric entities
I tried to use this behavior but I always get the same < > and &
perl -MCGI -we '$cgi = CGI->new();print $cgi->header(-charset =>
"UTF-8"); print $cgi->escapeHTML("asd <qwe&baz> tyu");'
Content-Type: text/html; charset=UTF-8
asd <qwe&baz> tyu
perl -MCGI -we '$cgi = CGI->new();$cgi->charset("UTF-8"); print
$cgi->charset() , $cgi->escapeHTML("asd <qwe&baz> tyu");'
UTF-8asd <qwe&baz> tyu
perl -MCGI -we '$cgi = CGI->new(); print $cgi->charset() ,
$cgi->escapeHTML("asd <qwe&baz> tyu");
'ISO-8859-1asd <qwe&baz> tyu
Is this a bug? If no please explain.
perl version v5.14.2, CGI version 3.61
Thanks!