diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-09-15 16:15:24 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-09-15 16:15:24 +0200 |
commit | 166766843cbc8304e4a6ac75963245a25cde050d (patch) | |
tree | 47a1defde0e5dd88d0cafbe499059fa621b37508 /bin | |
parent | f025a2f107bb389b2dbd50ef4e4d4ff912d993a1 (diff) |
hafas-m: UTF-8 support for input (especially for the ÖBB service...)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/hafas-m | 6 |
1 files changed, 5 insertions, 1 deletions
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; |