mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-08 07:24:21 +00:00
98_GAEBUS.pm: use utf-8 coding for values read from .csv files
git-svn-id: https://svn.fhem.de/fhem/trunk@9254 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3a73dc43f3
commit
6568947d2d
@ -11,7 +11,7 @@
|
||||
# 11.09.2015 : A.Goebel : add set w~ commands to set attributes for writing
|
||||
# 11.09.2015 : A.Goebel : add set <write-reading> command to write to ebusd
|
||||
# 13.09.2015 : A.Goebel : increase timeout for reads from ebusd from 1.8 to 5.0
|
||||
# 13.09.2015 : A.Goebel : use html entities to display values from ".csv" files
|
||||
# 14.09.2015 : A.Goebel : use utf-8 coding to display values from ".csv" files
|
||||
|
||||
package main;
|
||||
|
||||
@ -20,6 +20,7 @@ use warnings;
|
||||
use Time::HiRes qw(gettimeofday);
|
||||
use IO::Socket;
|
||||
use IO::Select;
|
||||
use Encode;
|
||||
|
||||
sub GAEBUS_Attr(@);
|
||||
|
||||
@ -182,6 +183,8 @@ GAEBUS_Set($@)
|
||||
|
||||
#Log3 ($hash, 3, "ebus1: reopen $name");
|
||||
|
||||
#Log3 ($hash, 2, "$name: set $arg $type invalid parameter");
|
||||
|
||||
if ($type eq "reopen") {
|
||||
Log3 ($hash, 3, "ebus1: reopen");
|
||||
GAEBUS_CloseDev($hash);
|
||||
@ -608,7 +611,6 @@ GAEBUS_ProcessCSV($$)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
my $line;
|
||||
my $buffer = "";
|
||||
|
||||
@ -619,28 +621,31 @@ GAEBUS_ProcessCSV($$)
|
||||
$defCircuit =~ s,^.*/,,;
|
||||
$defCircuit =~ s/\.csv$//;
|
||||
|
||||
binmode(CSV, ':encoding(utf-8)');
|
||||
while (<CSV>)
|
||||
{
|
||||
next if /^#/;
|
||||
next if /^\s$/;
|
||||
s/\r//;
|
||||
|
||||
s/ä/\ä/g;
|
||||
s/Ä/\Ä/g;
|
||||
s/ü/\ü/g;
|
||||
s/Ü/\Ü/g;
|
||||
s/ö/\ö/g;
|
||||
s/Ö/\Ö/g;
|
||||
s/ß/\ß/g;
|
||||
#s/ä/\ä/g;
|
||||
#s/Ä/\Ä/g;
|
||||
#s/ü/\Ä/g;
|
||||
#s/Ü/\Ü/g;
|
||||
#s/ö/\ö/g;
|
||||
#s/Ö/\Ö/g;
|
||||
#s/ß/\ß/g;
|
||||
#s/"/\"/g;
|
||||
|
||||
chomp;
|
||||
|
||||
$line = $_;
|
||||
$line = encode("UTF-8", $_);
|
||||
$line =~ s/ /_/g; # no blanks in names and comments
|
||||
$line =~ s/$delimiter/_/g; # clean up the delimiter within the text
|
||||
#$line =~ s/\|/_/g; # later used as delimiter in arguments
|
||||
|
||||
#Log3 ($hash, 2, "READ $file $line");
|
||||
|
||||
my ($io, $circuit, $vname, $comment, @params) = split (",", $line, 5);
|
||||
|
||||
# handle defaults: "^*"
|
||||
|
Loading…
x
Reference in New Issue
Block a user