Hello,
I needed to make some changes to the Apache::ASP::Server::HTMLEn/Decode
subroutines so they would suit a particular purpose in a project I am
working on.
I am putting this code out here for what it's worth. These work as
drop-in replacements for the subroutines by the same name in
Apache::ASP::Server.pm
Thanks.
<code>
#=======================================================================
======
# Contributed by John Drago <[EMAIL PROTECTED]>
#=======================================================================
======
sub HTMLDecode
{
my $self = shift if scalar(@_) > 1;
my $str = shift;
while( $str =~ /(&#(\d+);)/ )
{
my $whole = $1;
my $char = $2;
$char = chr($2);
$str =~ s/$whole/$char/g;
}# end while()
return $str;
}# end htmlDecode()
#=======================================================================
======
# Contributed by John Drago <[EMAIL PROTECTED]>
#=======================================================================
======
sub HTMLEncode
{
my $self = shift if scalar(@_) > 1;
my $str = shift;
return '' unless defined $str;
my $toEncode = ref($str) ? $str : \$str;
my $char;
$$toEncode =~ s/$1/"&#" . ord($char) . ";"/eg
while ($char) = (
$$toEncode =~ /
([^A-Z
a-z
0-9
[EMAIL PROTECTED]&\*\(\)\-_\+\=\{\}\[\]\:;'"\<,\>\.\?\\\/
\s
])/x );
if( ref($str) ){ return $toEncode }else{ return $$toEncode };
}# end htmlEncode()
</code>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]