2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 18:59:33 +00:00

UConv.pm: fix utf8 encoding

git-svn-id: https://svn.fhem.de/fhem/trunk@21115 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2020-02-04 11:52:56 +00:00
parent 683bdc2988
commit feaf7653b6

View File

@ -18,6 +18,7 @@ use Math::Trig ':great_circle';
use Scalar::Util qw(looks_like_number); use Scalar::Util qw(looks_like_number);
use Time::HiRes qw(gettimeofday); use Time::HiRes qw(gettimeofday);
use Time::Local; use Time::Local;
use Encode;
#use Data::Dumper; #use Data::Dumper;
@ -50,15 +51,15 @@ our %compasspoints = (
[ "Nord-Nordost", "NNO", '⬈' ], [ "Nord-Nordost", "NNO", '⬈' ],
[ "Nord-Ost", "NO", '⬈' ], [ "Nord-Ost", "NO", '⬈' ],
[ "Ost-Nordost", "ONO", '⬈' ], [ "Ost-Nordost", "ONO", '⬈' ],
[ "Ost", "O", '▶' ], [ "Osten", "O", '▶' ],
[ "Ost-Südost", "OSO", '⬊' ], [ "Ost-Südost", "OSO", '⬊' ],
[ "Südost", "SO", '⬊' ], [ "Südost", "SO", '⬊' ],
[ "Süd-Südost", "SSO", '⬊' ], [ "Süd-Südost", "SSO", '⬊' ],
[ "Süd", "S", '▼' ], [ "Süden", "S", '▼' ],
[ "Süd-Südwest", "SSW", '⬋' ], [ "Süd-Südwest", "SSW", '⬋' ],
[ "Südwest", "SW", '⬋' ], [ "Südwest", "SW", '⬋' ],
[ "West-Südwest", "WSW", '⬋' ], [ "West-Südwest", "WSW", '⬋' ],
[ "West", "W", '◀' ], [ "Westen", "W", '◀' ],
[ "West-Nordwest", "WNW", '⬉' ], [ "West-Nordwest", "WNW", '⬉' ],
[ "Nordwest", "NW", '⬉' ], [ "Nordwest", "NW", '⬉' ],
[ "Nord-Nordwest", "NNW", '⬉' ], [ "Nord-Nordwest", "NNW", '⬉' ],
@ -796,12 +797,12 @@ sub direction2compasspoint($;$$) {
} }
return ( return (
$directions_txt_i18n->[$i][0], encode_utf8 $directions_txt_i18n->[$i][0],
$directions_txt_i18n->[$i][1], $directions_txt_i18n->[$i][1],
$directions_txt_i18n->[$i][2] encode_utf8 $directions_txt_i18n->[$i][2]
) if wantarray; ) if wantarray;
return $directions_txt_i18n->[$i][2] if ( $txt && $txt == 3. ); return encode_utf8 $directions_txt_i18n->[$i][2] if ( $txt && $txt == 3. );
return $directions_txt_i18n->[$i][0] if ( $txt && $txt == 2. ); return encode_utf8 $directions_txt_i18n->[$i][0] if ( $txt && $txt == 2. );
return $directions_txt_i18n->[$i][1]; return $directions_txt_i18n->[$i][1];
} }
@ -1054,11 +1055,11 @@ sub compasspoint2compasspoint($;$$$) {
my $i; my $i;
my $i2; my $i2;
my $f = 0; my $f = 0;
my $f2 = 0;
foreach my $a ( @{$fromDirections_txt_i18n} ) { foreach my $a ( @{$fromDirections_txt_i18n} ) {
my $f2 = 0;
foreach my $b ( @{$a} ) { foreach my $b ( @{$a} ) {
if ( lc($b) eq lc($shortTxt) ) { if ( lc($b) eq lc( decode_utf8($shortTxt) ) ) {
$i2 = $f2; $i2 = $f2;
last; last;
} }
@ -1083,12 +1084,12 @@ sub compasspoint2compasspoint($;$$$) {
} }
return ( return (
$toDirections_txt_i18n->[$i][0], encode_utf8 $toDirections_txt_i18n->[$i][0],
$toDirections_txt_i18n->[$i][1], $toDirections_txt_i18n->[$i][1],
$toDirections_txt_i18n->[$i][2] encode_utf8 $toDirections_txt_i18n->[$i][2]
) if wantarray; ) if wantarray;
return $toDirections_txt_i18n->[$i][2] if ( $txt == 3. ); return encode_utf8 $toDirections_txt_i18n->[$i][2] if ( $txt == 3. );
return $toDirections_txt_i18n->[$i][0] if ( $txt == 2. ); return encode_utf8 $toDirections_txt_i18n->[$i][0] if ( $txt == 2. );
return $toDirections_txt_i18n->[$i][1]; return $toDirections_txt_i18n->[$i][1];
} }
@ -1109,11 +1110,11 @@ sub compasspoint2direction($;$) {
my $i; my $i;
my $i2; my $i2;
my $f = 0; my $f = 0;
my $f2 = 0;
foreach my $a ( @{$fromDirections_txt_i18n} ) { foreach my $a ( @{$fromDirections_txt_i18n} ) {
my $f2 = 0;
foreach my $b ( @{$a} ) { foreach my $b ( @{$a} ) {
if ( lc($b) eq lc($shortTxt) ) { if ( lc($b) eq lc( decode_utf8($shortTxt) ) ) {
$i2 = $f2; $i2 = $f2;
last; last;
} }