From 5262934e0d854a5ce001d84165f73a24803f158d Mon Sep 17 00:00:00 2001 From: Pragmatic Software Date: Tue, 5 Sep 2017 00:18:35 -0700 Subject: [PATCH] Improve Logger text escaping --- PBot/Logger.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PBot/Logger.pm b/PBot/Logger.pm index fa28d41f..67c15e5b 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])/'\\' . ord $1/ge; + $text =~ s/(\P{PosixGraph})/my $ch = $1; if ($ch =~ m{[\s]}) { $ch } else { sprintf "\\x%02X", ord $ch }/ge; if(defined $self->{log_file}) { print PLOG_FILE "$time :: $text";