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:
parent
7f4bc2024a
commit
d8e0200465
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user