fhem.pl: escapeLogLine patch from Boris

git-svn-id: svn://svn.code.sf.net/p/fhem/code/trunk@5237 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig
2014-03-16 16:16:32 +00:00
parent 9d94e4059f
commit ddf951dcfa

View File

@@ -3739,15 +3739,21 @@ utf8ToLatin1($)
sub escapeLogLine($) {
my ($s)= @_;
# http://perldoc.perl.org/perlrebackslash.html
my %escSequences = (
'\t' => "\\t",
'\a' => "\\a",
'\e' => "\\e",
'\f' => "\\f",
'\n' => "\\n",
'\r' => "\\r",
'\t' => "\\t",
);
$s =~ s/\\/\\\\/g;
foreach my $regex (keys %escSequences) {
$s =~ s/$regex/$escSequences{$regex}/g;
}
$s =~ s/([\000-\037])/sprintf("\\%03o", ord($1))/eg;
return $s;
}