[cgiapp] Re: utf8 form processing
Silent
silent2600 at gmail.com
Wed Oct 22 03:11:04 EDT 2008
the CGI::charset() is useful when I use escapeHTML() to escape form values,
in CGI.pm :
####################
sub escapeHTML {
...
...
my $latin = uc $self->{'.charset'} eq 'ISO-8859-1' ||
uc $self->{'.charset'} eq 'WINDOWS-1252';
if ($latin) { # bug in some browsers
$toencode =~ s{'}{'}gso;
$toencode =~ s{\x8b}{‹}gso;
$toencode =~ s{\x9b}{›}gso;
if (defined $newlinestoo && $newlinestoo) {
$toencode =~ s{\012}{ }gso;
$toencode =~ s{\015}{ }gso;
}
}
####################
2008/10/22 Rhesa Rozendaal <perl at rhesa.com>:
> Silent wrote:
>>
>> when I met a bad character problem, I use this
>> $cap->query()->charset('utf-8') in cgiapp_init()
>
> Yeah, that's also pretty much a prerequisite for outputting proper
> utf8-encoded pages. However, it only affects output AFAIK, so you need both
> pieces to this puzzle.
>
> rhesa
>
> ##### CGI::Application community mailing list ################
> ## ##
> ## To unsubscribe, or change your message delivery options, ##
> ## visit: http://lists.openlib.org/mailman/listinfo/cgiapp ##
> ## ##
> ## Web archive: http://lists.openlib.org/pipermail/cgiapp/ ##
> ## Wiki: http://cgiapp.erlbaum.net/ ##
> ## ##
> ################################################################
>
>
More information about the cgiapp
mailing list