From 166766843cbc8304e4a6ac75963245a25cde050d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 15 Sep 2015 16:15:24 +0200 Subject: hafas-m: UTF-8 support for input (especially for the ÖBB service...) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/hafas-m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/hafas-m b/bin/hafas-m index 3a1458b..d4eac7e 100755 --- a/bin/hafas-m +++ b/bin/hafas-m @@ -5,6 +5,7 @@ use 5.010; our $VERSION = '1.05'; +use Encode qw(decode); use Getopt::Long qw(:config no_ignore_case); use List::MoreUtils qw(uniq); use List::Util qw(first max); @@ -22,6 +23,9 @@ my ( @excluded_mots, @exclusive_mots ); my @output; binmode( STDOUT, ':encoding(utf-8)' ); +for my $arg (@ARGV) { + $arg = decode( 'UTF-8', $arg ); +} GetOptions( 'a|arrivals' => \$arrivals, @@ -86,7 +90,7 @@ sub parse_mot_options { for my $type ( split( qr{,}, $types ) ) { if ( $type eq 'help' or $type eq 'list' or $type eq '?' ) { my $desc = Travel::Status::DE::HAFAS::get_service($service); - if ($desc) { + if ($desc) { my @mots = @{ $desc->{productbits} }; @mots = grep { $_ ne 'x' } @mots; @mots = uniq @mots; -- cgit v1.2.3