summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2025-10-15 18:55:06 +0200
committerBirte Kristina Friesel <derf@finalrewind.org>2025-10-15 18:55:06 +0200
commiteba2e6a7f60ada260291f41cada0e6bd3274a500 (patch)
tree3f601350b710f194c9c0bc297e1b8371dc5e504f /lib
parent61cf8cfbd7f22726fdeed5c0a08f8833cb127cc1 (diff)
Use URI::Escape to escape umlauts in place/name arguments
This fixes VVO and LinzAG issues with umlauts
Diffstat (limited to 'lib')
-rw-r--r--lib/Travel/Status/DE/EFA.pm11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/EFA.pm b/lib/Travel/Status/DE/EFA.pm
index 7dfbc3b..bcf23cc 100644
--- a/lib/Travel/Status/DE/EFA.pm
+++ b/lib/Travel/Status/DE/EFA.pm
@@ -20,6 +20,7 @@ use Travel::Status::DE::EFA::Services;
use Travel::Status::DE::EFA::Stop;
use Travel::Status::DE::EFA::Trip;
use LWP::UserAgent;
+use URI::Escape qw(uri_escape);
sub new_p {
my ( $class, %opt ) = @_;
@@ -68,6 +69,7 @@ sub new_p {
sub new {
my ( $class, %opt ) = @_;
+ my $encoding = 'UTF-8';
my $tls_insecure = 0;
$opt{timeout} //= 10;
if ( $opt{timeout} <= 0 ) {
@@ -111,6 +113,9 @@ sub new {
if ( not $service->{tls_verify} ) {
$tls_insecure = 1;
}
+ if ( $service->{encoding} ) {
+ $encoding = $service->{encoding};
+ }
}
}
@@ -232,14 +237,16 @@ sub new {
itdDateYear => $dt->year,
itdTimeHour => $dt->hour,
itdTimeMinute => $dt->minute,
- name_dm => encode( 'UTF-8', $opt{name} ),
+ name_dm =>
+ uri_escape( encode( $encoding, $opt{name} ), '^A-Za-z0-9-._~ ' ),
};
}
if ( $opt{place} ) {
$self->{post}{placeInfo_dm} = 'invalid';
$self->{post}{placeState_dm} = 'empty';
- $self->{post}{place_dm} = encode( 'UTF-8', $opt{place} );
+ $self->{post}{place_dm}
+ = uri_escape( encode( $encoding, $opt{place} ), '^A-Za-z0-9-._~ ' );
}
if ( $opt{full_routes} ) {