From c9ea3ac0c81a6b3c228bec38303b24c68e00a240 Mon Sep 17 00:00:00 2001 From: b Date: Thu, 18 May 2023 22:34:46 +0000 Subject: [PATCH] HTML entity encoding --- botm-common | 2 +- sendpost.1.pl | 16 ++++++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/botm-common b/botm-common index 6cc2a02..b32a014 160000 --- a/botm-common +++ b/botm-common @@ -1 +1 @@ -Subproject commit 6cc2a0295896e671fa71946ca6428f0c806a9a77 +Subproject commit b32a014fe5391f7557580eb2e1263e2f8e7bfc94 diff --git a/sendpost.1.pl b/sendpost.1.pl index 2d12d60..49b9ef5 100644 --- a/sendpost.1.pl +++ b/sendpost.1.pl @@ -21,7 +21,12 @@ use Getopt::Long; use Encode qw(encode decode); ###PERL_LIB: use lib '/botm/lib/post'; -use botm_common qw(read_data_file write_data_file url_encode url_decode join_path); +use botm_common ( + 'read_data_file', 'write_data_file', + 'url_encode', 'url_decode', + 'join_path', + 'html_entity_encode_dec', 'html_entity_encode_hex' +); ###PERL_ENCODING_FILE_IN: use constant ENCODING_FILE_IN => 'UTF-8'; ###PERL_ENCODING_FILE_OUT: use constant ENCODING_FILE_OUT => 'utf8'; @@ -98,6 +103,14 @@ GetOptions ( 'help|h' => \$options{ 'help'} ); +print html_entity_encode_dec('')."\n"; +print html_entity_encode_dec('', '', 1)."\n"; +print html_entity_encode_dec('', 'UTF-8', 1)."\n"; +print html_entity_encode_hex('')."\n"; +print html_entity_encode_hex('', '', 1)."\n"; +print html_entity_encode_hex('', 'UTF-8', 1)."\n"; +exit 0; + if ($options{'help'} ne '') { print HELP_TEXT; exit 0; @@ -129,7 +142,6 @@ foreach my $arg (@ARGV) { # } # } - sub prepare_post { (my $cmd_options, my $file_data) = @_; my %post; -- 2.30.2