2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

fhem.pl: shutdown restart on encoding change

git-svn-id: https://svn.fhem.de/fhem/trunk@25704 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2022-02-18 19:18:57 +00:00
parent 651b9c7269
commit 88f9b0f3b8
4 changed files with 21 additions and 6 deletions

View File

@ -1280,6 +1280,7 @@ 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);
my ($p,$v) = split("=",$pv, 2);
$v = "" if(!defined($v));

View File

@ -1609,8 +1609,12 @@ The following local attributes are used by a wider range of devices:
<li>encoding<br>
Set the internal encoding used for storing strings.
Possible values: bytestream (default) and unicode.<br>
Note: Since not all modules were checked, if they work correctly with
the internal unicode encoding, this feature is experimental.
Notes:
<ul>
<li>Since not all modules were checked, if they work correctly with
the internal unicode encoding, this feature is experimental.</li>
<li>Changing the attribute value triggers a save and a shutdown restart</li>
</ul>
</li><br>
<a name="featurelevel"></a>

View File

@ -1714,8 +1714,12 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
<li>encoding<br>
W&auml;hlt das perl-interne Format, mit dem Strings kodiert sind.
M&ouml;gliche Werte sind: bytestream (Voreinstellung) und unicode.<br>
Achtung: der Wert unicode ist experimentell, da nicht alle FHEM-Module
mit dieser Variante gepr&uuml;ft wurden.
Achtung:
<ul>
<li>der Wert unicode ist experimentell, da nicht alle FHEM-Module
mit dieser Variante gepr&uuml;ft wurden.</li>
<li>&auml;ndern des Wertes bewirkt ein save und ein shutdown restart.</li>
</ul>
</li><br>
<a name="featurelevel"></a>

View File

@ -2877,11 +2877,10 @@ GlobalAttr($$$$)
my ($type, $me, $name, $val) = @_;
if($type eq "del") {
my %noDel = ( modpath=>1, verbose=>1, logfile=>1, configfile=>1 );
my %noDel = ( modpath=>1, verbose=>1, logfile=>1, configfile=>1, encoding=>1 );
return "The global attribute $name cannot be deleted" if($noDel{$name});
$featurelevel = 6.1 if($name eq "featurelevel");
$haveInet6 = 0 if($name eq "useInet6"); # IPv6
$unicodeEncoding = undef if($name eq "encoding");
delete($defs{global}{ignoreRegexpObj}) if($name eq "ignoreRegexp");
return undef;
}
@ -2904,6 +2903,13 @@ GlobalAttr($$$$)
if($name eq "encoding") { # Should be called from fhem.cfg/configDB
return "bad encoding parameter $val, good values are bytestream or unicode"
if($val ne "unicode" && $val ne "bytestream");
if($init_done) {
InternalTimer(0, sub {
CommandSave(undef, undef);
CommandShutdown(undef, "restart");
}, undef);
return;
}
$unicodeEncoding = ($val eq "unicode");
$currlogfile = "";
}