diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2009-07-01 09:05:01 +0200 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2009-07-01 09:05:01 +0200 |
commit | df2ec5d7bff6adf2d1dd044278e3deb9c0e12bb2 (patch) | |
tree | cfae0e83a91a830509e0913358d61247aa13d409 /bin/efa | |
parent | 1eaa5947201980e3c038e711839b7a5ee7608093 (diff) |
efa: efa.vrr.de changed something, fixed the resulting encoding fuckup
Note that the arguments to efa are not recoded, so don't use unicode there
Diffstat (limited to 'bin/efa')
-rwxr-xr-x | bin/efa | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -4,7 +4,7 @@ use strict; use warnings; use 5.010; -use encoding 'utf8'; +use Encode; use Getopt::Long; use WWW::Mechanize; @@ -77,7 +77,7 @@ sub parse_content($) { splice(@{$raw->[$offer]}, $offset+7, 0, ''); } for my $j (0, 4, 8) { - until (not exists($raw->[$offer]->[$offset+$j]) or $raw->[$offer]->[$offset+$j] =~ /^(\d+:\d+|ab |)$/) { + until (not exists($raw->[$offer]->[$offset+$j]) or $raw->[$offer]->[$offset+$j] =~ /^(\d+:\d+|ab |)$/) { last unless (exists($raw->[$offer]->[$offset+$j])); last if ($raw->[$offer]->[$offset+$j] eq 'Verspätungen sind berücksichtigt'); if ($raw->[$offer]->[$offset+$j] =~ /^\s*$/) { @@ -107,8 +107,7 @@ sub prepare_content($) { my $html = shift; my $offer = 0; my $return; - # beware of the no-break space (U+00A0) ↓ ↓ - foreach (split(/<span class="labelTextBold"> \d+\. Fahrt<\/span>/, $html)) { + foreach (split(/<span class="labelTextBold"> \d+\. Fahrt<\/span>/, $html)) { unless ($offer) { $offer++; next; @@ -267,7 +266,8 @@ $www->submit_form( fields => \%post, ); $content = $www->content; - +$content =~ s/\xa0/ /gs; +$content = encode('utf-8', decode('iso-8859-1', $content)); if (check_ambiguous($content)) { exit(1); |