2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

01_FHEMWEB.pm/98_telnet.pm: utf8/wide char fixes (Forum #55539)

git-svn-id: https://svn.fhem.de/fhem/trunk@11789 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2016-07-12 13:44:14 +00:00
parent 239d43ef60
commit 9161aaa577
2 changed files with 3 additions and 2 deletions

View File

@ -464,7 +464,8 @@ FW_Read($$)
($FW_httpheader{"Accept-Encoding"} && ($FW_httpheader{"Accept-Encoding"} &&
$FW_httpheader{"Accept-Encoding"} =~ m/gzip/) && $FW_httpheader{"Accept-Encoding"} =~ m/gzip/) &&
$FW_use_zlib) { $FW_use_zlib) {
utf8::encode($FW_RET) if(utf8::is_utf8($FW_RET)); utf8::encode($FW_RET)
if(utf8::is_utf8($FW_RET) && $FW_RET =~ m/[^\x00-\xFF]/ );
eval { $FW_RET = Compress::Zlib::memGzip($FW_RET); }; eval { $FW_RET = Compress::Zlib::memGzip($FW_RET); };
if($@) { if($@) {
Log 1, "memGzip: $@"; $FW_RET=""; #Forum #29939 Log 1, "memGzip: $@"; $FW_RET=""; #Forum #29939

View File

@ -316,7 +316,7 @@ telnet_Output($$$)
$ret = "$ret\n" if(!$hash->{showPrompt}); $ret = "$ret\n" if(!$hash->{showPrompt});
} }
for(;;) { for(;;) {
utf8::encode($ret) if(utf8::is_utf8($ret)); utf8::encode($ret) if(utf8::is_utf8($ret) && $ret =~ m/[^\x00-\xFF]/);
my $l = syswrite($hash->{CD}, $ret); my $l = syswrite($hash->{CD}, $ret);
last if(!$l || $l == length($ret)); last if(!$l || $l == length($ret));
$ret = substr($ret, $l); $ret = substr($ret, $l);