2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 03:06:37 +00:00

01_FHEMWEB.pm: support newlines in attributes for encoding unicode (Forum #126088)

git-svn-id: https://svn.fhem.de/fhem/trunk@25717 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-02-20 18:02:01 +00:00
parent 72f6890c78
commit 1a0756d4d4

View File

@ -727,7 +727,7 @@ FW_addToWritebuffer($$@)
my ($hash, $txt, $callback, $nolimit, $encoded) = @_;
$txt = Encode::encode($hash->{encoding}, $txt)
if(!$encoded && ($unicodeEncoding ||
if($hash->{encoding} && !$encoded && ($unicodeEncoding ||
(utf8::is_utf8($txt) && $txt =~ m/[^\x00-\xFF]/)));
if( $hash->{websocket} ) {
my $len = length($txt);
@ -1283,7 +1283,10 @@ FW_digestCgi($)
next if($pv eq ""); # happens when post forgot to set FW_ME
$pv =~ s/\+/ /g;
$pv =~ s/%([\dA-F][\dA-F])/chr(hex($1))/ige;
$pv = Encode::decode('UTF-8', $pv) if($unicodeEncoding);
if($unicodeEncoding) {
$pv = Encode::decode('UTF-8', $pv);
$pv =~ s/\x{2424}/\n/g; # revert fhemweb.js hack
}
my ($p,$v) = split("=",$pv, 2);
$v = "" if(!defined($v));