From f4f610cf0f8e65e2f5a0db6e1257d7fd639b1516 Mon Sep 17 00:00:00 2001 From: rudolfkoenig <> Date: Sat, 9 Jul 2016 11:36:03 +0000 Subject: [PATCH] 98_telnet.pm/01_FHEMWEB.pm: defend agains wide-charater crash (Forum #55421) git-svn-id: https://svn.fhem.de/fhem/trunk@11772 2b470e98-0d58-463d-a4d8-8e2adae1ed80 --- fhem/FHEM/01_FHEMWEB.pm | 1 + fhem/FHEM/98_telnet.pm | 1 + 2 files changed, 2 insertions(+) diff --git a/fhem/FHEM/01_FHEMWEB.pm b/fhem/FHEM/01_FHEMWEB.pm index 3a15ed065..bfdcbac69 100755 --- a/fhem/FHEM/01_FHEMWEB.pm +++ b/fhem/FHEM/01_FHEMWEB.pm @@ -464,6 +464,7 @@ FW_Read($$) ($FW_httpheader{"Accept-Encoding"} && $FW_httpheader{"Accept-Encoding"} =~ m/gzip/) && $FW_use_zlib) { + utf8::encode($FW_RET) if(utf8::is_utf8($FW_RET)); eval { $FW_RET = Compress::Zlib::memGzip($FW_RET); }; if($@) { Log 1, "memGzip: $@"; $FW_RET=""; #Forum #29939 diff --git a/fhem/FHEM/98_telnet.pm b/fhem/FHEM/98_telnet.pm index 30660a326..1a4388f87 100644 --- a/fhem/FHEM/98_telnet.pm +++ b/fhem/FHEM/98_telnet.pm @@ -316,6 +316,7 @@ telnet_Output($$$) $ret = "$ret\n" if(!$hash->{showPrompt}); } for(;;) { + utf8::encode($ret) if(utf8::is_utf8($ret)); my $l = syswrite($hash->{CD}, $ret); last if(!$l || $l == length($ret)); $ret = substr($ret, $l);