summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-07 10:49:16 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-07 10:49:16 +0100
commitd1ead7ba9bc3bd442f1cc5bb5bf97a46b793b62f (patch)
treedfed001b06e7e7300fe589076c83862a6a0f633d
parentd63bafea6ce6ba6e9551597327f71f69c79062b7 (diff)
efa / VRR.pm: Handle UTF8 / decoded input with non-ASCII chars
-rw-r--r--Changelog5
-rwxr-xr-xbin/efa7
-rw-r--r--lib/Travel/Routing/DE/VRR.pm5
3 files changed, 16 insertions, 1 deletions
diff --git a/Changelog b/Changelog
index 913de83..12e97e6 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,8 @@
+git HEAD
+
+ * efa: Handle UTF8 in place/stop input
+ * Travel::Routing::DE::VRR: Handle decoded input with non-ASCII characters
+
Travel::Routing::DE::VRR 2.03 - Thu Jul 4 2013
* Disable smartmatch warnings on perl >= 5.018
diff --git a/bin/efa b/bin/efa
index 583a48c..a6787f9 100755
--- a/bin/efa
+++ b/bin/efa
@@ -10,6 +10,7 @@ no if $] >= 5.018, warnings => "experimental::smartmatch";
use utf8;
+use Encode qw(decode);
use Travel::Routing::DE::VRR;
use Exception::Class;
use Getopt::Long qw/:config no_ignore_case/;
@@ -176,6 +177,12 @@ if ( not( @from and @to ) ) {
for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ],
[ \@to, \$to_type ], )
{
+
+ if ( @{ $pair->[0] } ) {
+ $pair->[0]->[0] = decode( 'UTF-8', $pair->[0]->[0] );
+ $pair->[0]->[1] = decode( 'UTF-8', $pair->[0]->[1] );
+ }
+
next if ( not defined $pair->[0]->[1] );
if (
diff --git a/lib/Travel/Routing/DE/VRR.pm b/lib/Travel/Routing/DE/VRR.pm
index 29a30b3..28dcf58 100644
--- a/lib/Travel/Routing/DE/VRR.pm
+++ b/lib/Travel/Routing/DE/VRR.pm
@@ -7,7 +7,7 @@ use 5.010;
no if $] >= 5.018, warnings => "experimental::smartmatch";
use Carp qw(cluck);
-use Encode qw(decode);
+use Encode qw(decode encode);
use Travel::Routing::DE::VRR::Route;
use LWP::UserAgent;
use XML::LibXML;
@@ -236,6 +236,9 @@ sub place {
);
}
+ $place = encode( 'ISO-8859-15', $place );
+ $stop = encode( 'ISO-8859-15', $stop );
+
$type //= 'stop';
@{ $self->{post} }{ "place_${which}", "name_${which}" } = ( $place, $stop );