mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 07:16:03 +00:00
fhem.pl: convert \n in json2namevalue (Forum #111684)
git-svn-id: https://svn.fhem.de/fhem/trunk@22082 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2b3205176e
commit
7cfec6a64b
@ -5137,7 +5137,11 @@ json2nameValue($;$$)
|
||||
if($s eq '\\') {
|
||||
$esc = !$esc;
|
||||
} elsif($s eq '"' && !$esc) {
|
||||
return (undef,substr($t,1,$off-1), substr($t,$off+1));
|
||||
my $val = substr($t,1,$off-1);
|
||||
$val =~ s/\\u([0-9A-F]{4})/chr(hex($1))/gsie; # toJSON reverse
|
||||
my %t = ( n =>"\n", '"'=>'"', '\\'=>'\\' );
|
||||
$val =~ s/\\([n"\\])/$t{$1}/ge;
|
||||
return (undef, $val, substr($t,$off+1));
|
||||
} else {
|
||||
$esc = 0;
|
||||
}
|
||||
@ -5198,7 +5202,6 @@ json2nameValue($;$$)
|
||||
if($val =~ m/^"/) {
|
||||
($err, $val, $in) = lStr($val);
|
||||
return ($err,undef) if($err);
|
||||
$val =~ s/\\u([0-9A-F]{4})/chr(hex($1))/gsie; # toJSON reverse
|
||||
setVal($ret, $map, $prefix, $name, $val);
|
||||
|
||||
} elsif($val =~ m/^{/) { # }
|
||||
|
Loading…
x
Reference in New Issue
Block a user