From c1a6e03c3569b80d1ed01abb1baaba2318b788bd Mon Sep 17 00:00:00 2001 From: tpoitzsch <> Date: Sun, 4 Oct 2015 12:40:48 +0000 Subject: [PATCH] FRITZBOX: handels now illegal backslash \' in JSON-Text git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@9367 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- FHEM/72_FRITZBOX.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/FHEM/72_FRITZBOX.pm b/FHEM/72_FRITZBOX.pm index 32505c47b..f0bc85777 100644 --- a/FHEM/72_FRITZBOX.pm +++ b/FHEM/72_FRITZBOX.pm @@ -2930,15 +2930,14 @@ sub FRITZBOX_Ring_Run_Web($) my $getCmdStr = "&ring_tone_radio_test=1&idx=".$_."&start_ringtest=1&ringtone=".$value; FRITZBOX_Log $hash, 4, "Reset ring tone of dect$_ to $value"; # Reset internet station for the Fritz!Fons - if ($ttsLink) - { + if ($ttsLink) { $value = $startValue->{dectUser}->[$_]->{RadioRingID}; push @webCmdArray, "telcfg:settings/Foncontrol/User".$_."/RadioRingID" => $value unless $useGuiHack; $getCmdStr .= "&ring_tone_radio_test=".$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 ; } } @@ -4280,11 +4279,15 @@ sub FRITZBOX_Web_Query($$@) # FRITZBOX_Log $hash, 3, "Response: ".$response->content; ################# + my $jsonText = $response->content; + # Remove illegal excape sequences + $jsonText =~ s/\\'/'/g; + my $jsonResult ; if ($charSet eq "UTF-8") { - $jsonResult = JSON->new->utf8->decode ($response->content); + $jsonResult = JSON->new->utf8->decode( $jsonText ); } else { - $jsonResult = JSON ->new->latin1->decode ($response->content); + $jsonResult = JSON->new->latin1->decode( $jsonText ); } $jsonResult->{sid} = $sid; return $jsonResult;