mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 09:16:53 +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:
parent
72f6890c78
commit
1a0756d4d4
@ -727,7 +727,7 @@ FW_addToWritebuffer($$@)
|
|||||||
my ($hash, $txt, $callback, $nolimit, $encoded) = @_;
|
my ($hash, $txt, $callback, $nolimit, $encoded) = @_;
|
||||||
|
|
||||||
$txt = Encode::encode($hash->{encoding}, $txt)
|
$txt = Encode::encode($hash->{encoding}, $txt)
|
||||||
if(!$encoded && ($unicodeEncoding ||
|
if($hash->{encoding} && !$encoded && ($unicodeEncoding ||
|
||||||
(utf8::is_utf8($txt) && $txt =~ m/[^\x00-\xFF]/)));
|
(utf8::is_utf8($txt) && $txt =~ m/[^\x00-\xFF]/)));
|
||||||
if( $hash->{websocket} ) {
|
if( $hash->{websocket} ) {
|
||||||
my $len = length($txt);
|
my $len = length($txt);
|
||||||
@ -1283,7 +1283,10 @@ FW_digestCgi($)
|
|||||||
next if($pv eq ""); # happens when post forgot to set FW_ME
|
next if($pv eq ""); # happens when post forgot to set FW_ME
|
||||||
$pv =~ s/\+/ /g;
|
$pv =~ s/\+/ /g;
|
||||||
$pv =~ s/%([\dA-F][\dA-F])/chr(hex($1))/ige;
|
$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);
|
my ($p,$v) = split("=",$pv, 2);
|
||||||
$v = "" if(!defined($v));
|
$v = "" if(!defined($v));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user