2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 12:49:34 +00:00

fhem.pl: escapeLogLine patch from Boris

git-svn-id: https://svn.fhem.de/fhem/trunk@5237 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2014-03-16 16:16:32 +00:00
parent 7f4bc2024a
commit d8e0200465

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;
}