]> bicyclesonthemoon.info Git - botm/common-perl/commitdiff
remove encoding option from HTML entity encoding v1.0.5
authorb <rowerynaksiezycu@gmail.com>
Thu, 18 May 2023 22:32:42 +0000 (22:32 +0000)
committerb <rowerynaksiezycu@gmail.com>
Thu, 18 May 2023 22:32:42 +0000 (22:32 +0000)
botm_common.pm

index b232826d96f6b8e4aad905152a853116c04d39f7..e5c5f014dc9e0c945d5f3f998dde0bcc9169039e 100644 (file)
@@ -25,7 +25,7 @@ use Exporter;
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
 # vX.Y.Z:      X YYYZZZ
-$VERSION     = 1.000004;
+$VERSION     = 1.000005;
 @ISA         = qw(Exporter);
 @EXPORT      = ();
 @EXPORT_OK   = (
@@ -2587,47 +2587,55 @@ use constant HTML_ENTITY_CODE_INF => {
 
 
 sub html_entity_encode_dec {
-       (my $t, my $encoding, my $all) = @_;
+       # (my $t, my $encoding, my $all) = @_;
+       (my $t, my $all) = @_;
        
        if ($all) {
-               $t =~ s/(.)/html_entity_encode_1ch_dec($1, $encoding)/eg;
+               # $t =~ s/(.)/html_entity_encode_1ch_dec($1, $encoding)/eg;
+               $t =~ s/(.)/html_entity_encode_1ch_dec($1)/eg;
        }
        else {
-               $t =~ s/([\"\&<=>])/html_entity_encode_1ch_dec($1, $encoding)/eg;
+               # $t =~ s/([\"\&<=>])/html_entity_encode_1ch_dec($1, $encoding)/eg;
+               $t =~ s/([\"\&<=>])/html_entity_encode_1ch_dec($1)/eg;
        }
        return $t;
 }
 
 sub html_entity_encode_hex {
-       (my $t, my $encoding, my $all) = @_;
+       # (my $t, my $encoding, my $all) = @_;
+       (my $t, my $all) = @_;
        
        if ($all) {
-               $t =~ s/(.)/html_entity_encode_1ch_hex($1, $encoding)/eg;
+               # $t =~ s/(.)/html_entity_encode_1ch_hex($1, $encoding)/eg;
+               $t =~ s/(.)/html_entity_encode_1ch_hex($1)/eg;
        }
        else {
-               $t =~ s/([\"\&<=>])/html_entity_encode_1ch_hex($1, $encoding)/eg;
+               # $t =~ s/([\"\&<=>])/html_entity_encode_1ch_hex($1, $encoding)/eg;
+               $t =~ s/([\"\&<=>])/html_entity_encode_1ch_hex($1)/eg;
        }
        return $t;
 }
 
 sub html_entity_encode_1ch_dec {
-       (my $ch, my $encoding) = @_;
+       # (my $ch, my $encoding) = @_;
+       (my $ch) = @_;
        
-       if ($encoding ne '') {
-               # escape byte values instead of code point value
-               $ch = encode($encoding, $ch);
-       }
+       if ($encoding ne '') {
+               # escape byte values instead of code point value
+               $ch = encode($encoding, $ch);
+       }
        $ch =~ s/(.)/sprintf('&#%02u;',ord($1))/eg;
        return $ch;
 }
 
 sub html_entity_encode_1ch_hex {
-       (my $ch, my $encoding) = @_;
+       # (my $ch, my $encoding) = @_;
+       (my $ch) = @_;
        
-       if ($encoding ne '') {
-               # escape byte values instead of code point value
-               $ch = encode($encoding, $ch);
-       }
+       if ($encoding ne '') {
+               # escape byte values instead of code point value
+               $ch = encode($encoding, $ch);
+       }
        $ch =~ s/(.)/sprintf('&#x%02X;',ord($1))/eg;
        return $ch;
 }