summaryrefslogtreecommitdiff
path: root/cgi
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-01-08 18:36:14 +0100
committerDaniel Friesel <derf@finalrewind.org>2014-01-08 18:36:14 +0100
commitcc3ef2ab672b1bdf1ed0bc1a921ef355f34b1415 (patch)
tree5465758318cd98e953d3914a0160bbbbab345b5d /cgi
parent0b120658e3701be30841b0b128b22d63d5a18af4 (diff)
Work around Cache::File UTF-8 problems
Diffstat (limited to 'cgi')
-rw-r--r--cgi/index.pl9
1 files changed, 7 insertions, 2 deletions
diff --git a/cgi/index.pl b/cgi/index.pl
index c02fbac..4134e4e 100644
--- a/cgi/index.pl
+++ b/cgi/index.pl
@@ -20,13 +20,18 @@ sub get_results_for {
default_expires => $refresh_interval . ' sec',
);
- my $results = $cache->thaw($station);
+ # Cache::File has UTF-8 problems, so strip it (and any other potentially
+ # problematic chars).
+ my $cstation = $station;
+ $cstation =~ tr{[0-9a-zA-Z -]}{}cd;
+
+ my $results = $cache->thaw($cstation);
if ( not $results ) {
my $status
= Travel::Status::DE::DeutscheBahn->new( station => $station );
$results = [ $status->results ];
- $cache->freeze( $station, $results );
+ $cache->freeze( $cstation, $results );
}
return @{$results};