mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
fhem.pl: fix JSON decoding in utf-8 encoding mode (Forum #128932)
git-svn-id: https://svn.fhem.de/fhem/trunk@26369 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
b7c536db01
commit
96697248c8
@ -3709,6 +3709,7 @@ EvalSpecials($%)
|
||||
if(defined($specials{"%EVENT"})) {
|
||||
foreach my $part (split(" ", $specials{"%EVENT"})) {
|
||||
$specials{"%EVTPART$idx"} = $part;
|
||||
last if($idx >= 20);
|
||||
$idx++;
|
||||
}
|
||||
}
|
||||
@ -5342,7 +5343,10 @@ json2nameValue($;$$$$)
|
||||
$esc = !$esc;
|
||||
} elsif($s eq '"' && !$esc) {
|
||||
my $val = substr($t,1,$off-1);
|
||||
$val =~ s/\\u([0-9A-F]{4})/chr(hex($1))/gsie; # toJSON reverse
|
||||
if($val =~ m/\\u([0-9A-F]{4})/i) {
|
||||
$val =~ s/\\u([0-9A-F]{4})/chr(hex($1))/gsie; # toJSON reverse
|
||||
$val = Encode::encode("UTF-8", $val) if(!$unicodeEncoding); #128932
|
||||
}
|
||||
my %t = ( n =>"\n", '"'=>'"', '\\'=>'\\' );
|
||||
$val =~ s/\\([n"\\])/$t{$1}/ge;
|
||||
return (undef, $val, substr($t,$off+1));
|
||||
|
Loading…
x
Reference in New Issue
Block a user