2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 13:24:56 +00:00

59_Wunderground: fix UTF8 encoding

git-svn-id: https://svn.fhem.de/fhem/trunk@12669 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
jpawlowski 2016-11-27 12:05:20 +00:00
parent 4c73e3beeb
commit 8592911615

View File

@ -31,7 +31,8 @@ use strict;
use warnings;
use vars qw(%data);
use HttpUtils;
use Encode;
use utf8;
use Encode qw(encode_utf8 decode_utf8);
use Unit;
use Data::Dumper;
@ -701,8 +702,13 @@ sub Wunderground_Hash2Readings($$;$) {
}
$reading = "fc" . $period . "_";
$h->{fcttext_metric} =~ s/(\d)C/$1°C/g;
$h->{fcttext} =~ s/(\d)F/$1 °F/g;
my $symbol_c = Encode::encode_utf8( chr(0x202F) . chr(0x00B0) . 'C' );
my $symbol_f = Encode::encode_utf8( chr(0x202F) . chr(0x00B0) . 'F' );
my $symbol_pct = Encode::encode_utf8( chr(0x00A0) . '%' );
$h->{fcttext_metric} =~ s/(\d)C/$1$symbol_c/g;
$h->{fcttext} =~ s/(\d)F/$1$symbol_f/g;
$h->{fcttext_metric} =~ s/(\d)\s*%/$1$symbol_pct/g;
$h->{fcttext} =~ s/(\d)\s*%/$1$symbol_pct/g;
readingsBulkUpdate( $hash, $reading . "icon$night",
$h->{icon} );