fhem.pl: toJSON numeric fix (Forum #100951)

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@19485 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2019-05-29 16:35:33 +00:00
parent a946402b5c
commit 5b50989347

View File

@ -5050,6 +5050,9 @@ toJSON($)
if(not defined $val) { if(not defined $val) {
return "null"; return "null";
} elsif (length( do { no warnings "numeric"; $val & "" } )) {
return $val;
} elsif (not ref $val) { } elsif (not ref $val) {
$val =~ s/([\x00-\x1f\x22\x5c\x7f])/sprintf '\u%04x', ord($1)/ge; $val =~ s/([\x00-\x1f\x22\x5c\x7f])/sprintf '\u%04x', ord($1)/ge;