FRITZBOX: handels now illegal backslash \' in JSON-Text

git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@9367 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
tpoitzsch 2015-10-04 12:40:48 +00:00
parent 56d7bc671b
commit c1a6e03c35

View File

@ -2930,15 +2930,14 @@ sub FRITZBOX_Ring_Run_Web($)
my $getCmdStr = "&ring_tone_radio_test=1&idx=".$_."&start_ringtest=1&ringtone=".$value; my $getCmdStr = "&ring_tone_radio_test=1&idx=".$_."&start_ringtest=1&ringtone=".$value;
FRITZBOX_Log $hash, 4, "Reset ring tone of dect$_ to $value"; FRITZBOX_Log $hash, 4, "Reset ring tone of dect$_ to $value";
# Reset internet station for the Fritz!Fons # Reset internet station for the Fritz!Fons
if ($ttsLink) if ($ttsLink) {
{
$value = $startValue->{dectUser}->[$_]->{RadioRingID}; $value = $startValue->{dectUser}->[$_]->{RadioRingID};
push @webCmdArray, "telcfg:settings/Foncontrol/User".$_."/RadioRingID" => $value push @webCmdArray, "telcfg:settings/Foncontrol/User".$_."/RadioRingID" => $value
unless $useGuiHack; unless $useGuiHack;
$getCmdStr .= "&ring_tone_radio_test=".$value; $getCmdStr .= "&ring_tone_radio_test=".$value;
FRITZBOX_Log $hash, 4, "Reset radio station of dect$_ to $value"; FRITZBOX_Log $hash, 4, "Reset radio station of dect$_ to $value";
} }
push @getCmdArray, [ "fon_devices/edit_dect_ring_tone.lua" => $getCmdStr] push @getCmdArray, [ "fon_devices/edit_dect_ring_tone.lua" => $getCmdStr ]
if $useGuiHack ; if $useGuiHack ;
} }
} }
@ -4280,11 +4279,15 @@ sub FRITZBOX_Web_Query($$@)
# FRITZBOX_Log $hash, 3, "Response: ".$response->content; # FRITZBOX_Log $hash, 3, "Response: ".$response->content;
################# #################
my $jsonText = $response->content;
# Remove illegal excape sequences
$jsonText =~ s/\\'/'/g;
my $jsonResult ; my $jsonResult ;
if ($charSet eq "UTF-8") { if ($charSet eq "UTF-8") {
$jsonResult = JSON->new->utf8->decode ($response->content); $jsonResult = JSON->new->utf8->decode( $jsonText );
} else { } else {
$jsonResult = JSON ->new->latin1->decode ($response->content); $jsonResult = JSON->new->latin1->decode( $jsonText );
} }
$jsonResult->{sid} = $sid; $jsonResult->{sid} = $sid;
return $jsonResult; return $jsonResult;