From: b Date: Thu, 18 May 2023 22:32:42 +0000 (+0000) Subject: remove encoding option from HTML entity encoding X-Git-Tag: v1.0.5 X-Git-Url: http://bicyclesonthemoon.info/git-projects/?a=commitdiff_plain;h=b32a014fe5391f7557580eb2e1263e2f8e7bfc94;p=botm%2Fcommon-perl remove encoding option from HTML entity encoding --- diff --git a/botm_common.pm b/botm_common.pm index b232826..e5c5f01 100644 --- a/botm_common.pm +++ b/botm_common.pm @@ -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; }