From 39008afc0b485f757f2686c73ca05890525a2137 Mon Sep 17 00:00:00 2001 From: Andreas Schildbach Date: Mon, 16 Feb 2015 06:55:48 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20umlauts=20in=20suggested=20locations=20fo?= =?UTF-8?q?r=20Rhineland-Palatinate,=20Rhine-Neckar=20&=20Baden-W=C3=BCrtt?= =?UTF-8?q?emberg.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- enabler/src/de/schildbach/pte/VrnProvider.java | 7 ++++++- .../schildbach/pte/live/VrnProviderLiveTest.java | 16 +++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/enabler/src/de/schildbach/pte/VrnProvider.java b/enabler/src/de/schildbach/pte/VrnProvider.java index fcf8845c..ecee886f 100644 --- a/enabler/src/de/schildbach/pte/VrnProvider.java +++ b/enabler/src/de/schildbach/pte/VrnProvider.java @@ -19,6 +19,8 @@ package de.schildbach.pte; import javax.annotation.Nullable; +import com.google.common.base.Charsets; + import de.schildbach.pte.dto.Line; import de.schildbach.pte.dto.Product; @@ -27,13 +29,16 @@ import de.schildbach.pte.dto.Product; */ public class VrnProvider extends AbstractEfaProvider { - private static final String API_BASE = "http://fahrplanauskunft.vrn.de/vrn_mobile/"; + private static final String API_BASE = "http://fahrplanauskunft.vrn.de/vrn/"; + // http://fahrplanauskunft.vrn.de/vrn_mobile/ // http://efa9.vrn.de/vrt/ public VrnProvider() { super(NetworkId.VRN, API_BASE); + + setRequestUrlEncoding(Charsets.UTF_8); } @Override diff --git a/enabler/test/de/schildbach/pte/live/VrnProviderLiveTest.java b/enabler/test/de/schildbach/pte/live/VrnProviderLiveTest.java index 47af59f5..1a2c5bcc 100644 --- a/enabler/test/de/schildbach/pte/live/VrnProviderLiveTest.java +++ b/enabler/test/de/schildbach/pte/live/VrnProviderLiveTest.java @@ -17,7 +17,9 @@ package de.schildbach.pte.live; +import static org.hamcrest.CoreMatchers.hasItem; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertThat; import static org.junit.Assert.assertTrue; import java.util.Date; @@ -85,7 +87,8 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest @Test public void suggestLocationsWithUmlaut() throws Exception { - final SuggestLocationsResult result = suggestLocations("grün"); + final SuggestLocationsResult result = suggestLocations("Käfertal"); + assertThat(result.getLocations(), hasItem(new Location(LocationType.STATION, "6005547"))); print(result); } @@ -166,4 +169,15 @@ public class VrnProviderLiveTest extends AbstractProviderLiveTest final QueryTripsResult earlierResult = queryMoreTrips(later2Result.context, false); print(earlierResult); } + + @Test + public void tripWithUmlaut() throws Exception + { + final QueryTripsResult result = queryTrips(new Location(LocationType.ANY, null, null, "Käfertal"), null, new Location(LocationType.STATION, + "6002417", "Mannheim", "Hauptbahnhof"), new Date(), true, Product.ALL, WalkSpeed.NORMAL, Accessibility.NEUTRAL); + print(result); + assertEquals(QueryTripsResult.Status.OK, result.status); + assertTrue(result.trips.size() > 0); + assertEquals(result.trips.get(0).from, new Location(LocationType.STATION, "6005547")); + } }