From 5ee07e08d2fc3a74545e2c1a016f072fa86ba6d8 Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Sat, 2 Sep 2017 00:19:39 -0700 Subject: [PATCH] Replace control chars with escaped ordinals --- PBot/Interpreter.pm | 1 + PBot/Logger.pm | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/PBot/Interpreter.pm b/PBot/Interpreter.pm index e86b6677..53423932 100644 --- a/PBot/Interpreter.pm +++ b/PBot/Interpreter.pm @@ -82,6 +82,7 @@ sub process_line { $text =~ s/^\s+//; $text =~ s/\s+$//; + $text =~ s/([\01-\010]|[\016-\037])/'\\' . ord $1/ge; my $cmd_text = $text; $cmd_text =~ s/^\/me\s+//; diff --git a/PBot/Logger.pm b/PBot/Logger.pm index 10d99376..fa28d41f 100644 --- a/PBot/Logger.pm +++ b/PBot/Logger.pm @@ -36,7 +36,7 @@ sub log { my ($self, $text) = @_; my $time = localtime; - $text =~ s/(?:[\01-\010]|[\016-\037])/^/g; + $text =~ s/([\01-\010]|[\016-\037])/'\\' . ord $1/ge; if(defined $self->{log_file}) { print PLOG_FILE "$time :: $text";