From bf6f6405f19795b9718cefc3eac3ecaafa7cf12e Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 7 Oct 2018 09:11:22 +0200 Subject: [PATCH] Fix UTF-8 --- index.pl | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/index.pl b/index.pl index f0242ed..1becd27 100755 --- a/index.pl +++ b/index.pl @@ -4,6 +4,7 @@ use Mojolicious::Lite; use Cache::File; use DateTime; use DBI; +use Encode qw(decode); use Geo::Distance; use List::Util qw(first); use List::MoreUtils qw(after_incl before_incl); @@ -454,6 +455,10 @@ helper 'get_user_travels' => sub { $raw_sched_ts, $raw_real_ts, $raw_route, $raw_messages ) = @row; + $name = decode( 'UTF-8', $name ); + $raw_route = decode( 'UTF-8', $raw_route ); + $raw_messages = decode( 'UTF-8', $raw_messages ); + if ( $action == $action_type{checkin} ) { push( @travels, @@ -499,8 +504,8 @@ helper 'get_user_status' => sub { if ( @{$rows} ) { my $now = DateTime->now( time_zone => 'Europe/Berlin' ); my $ts = epoch_to_dt( $rows->[0][1] ); - my $checkin_station_name = $rows->[0][3]; - my @route = split( qr{[|]}, $rows->[0][8] // q{} ); + my $checkin_station_name = decode( 'UTF-8', $rows->[0][3] ); + my @route = split( qr{[|]}, decode( 'UTF-8', $rows->[0][8] // q{} ) ); my @route_after; my $is_after = 0; for my $station (@route) {