fixed umlaut problem with Brandenburg auto-complete

This commit is contained in:
Andreas Schildbach 2012-12-15 11:55:05 +01:00
parent 209bb2b1e3
commit b389b13fac
3 changed files with 16 additions and 2 deletions

View file

@ -188,7 +188,7 @@ public class VbbProvider extends AbstractHafasProvider
public List<Location> autocompleteStations(final CharSequence constraint) throws IOException public List<Location> autocompleteStations(final CharSequence constraint) throws IOException
{ {
final String uri = String.format(AUTOCOMPLETE_URI, ParserUtils.urlEncode(constraint.toString(), ISO_8859_1)); final String uri = String.format(AUTOCOMPLETE_URI, ParserUtils.urlEncode(constraint.toString(), UTF_8));
return jsonGetStops(uri); return jsonGetStops(uri);
} }

View file

@ -22,6 +22,7 @@ import static junit.framework.Assert.assertEquals;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.BvgProvider; import de.schildbach.pte.BvgProvider;
@ -80,6 +81,16 @@ public class BvgProviderLiveTest extends AbstractProviderLiveTest
assertEquals(QueryDeparturesResult.Status.INVALID_STATION, resultPlan.status); assertEquals(QueryDeparturesResult.Status.INVALID_STATION, resultPlan.status);
} }
@Test
public void autocompleteUmlaut() throws Exception
{
final List<Location> autocompletes = provider.autocompleteStations("Güntzelstr.");
print(autocompletes);
Assert.assertEquals("Güntzelstr. (U)", autocompletes.get(0).name);
}
@Test @Test
public void autocompleteIncomplete() throws Exception public void autocompleteIncomplete() throws Exception
{ {

View file

@ -20,6 +20,7 @@ package de.schildbach.pte.live;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import de.schildbach.pte.NetworkProvider.Accessibility; import de.schildbach.pte.NetworkProvider.Accessibility;
@ -68,9 +69,11 @@ public class VbbProviderLiveTest extends AbstractProviderLiveTest
@Test @Test
public void autocompleteUmlaut() throws Exception public void autocompleteUmlaut() throws Exception
{ {
final List<Location> autocompletes = provider.autocompleteStations("Hedwigshöhe"); final List<Location> autocompletes = provider.autocompleteStations("Güntzelstr.");
print(autocompletes); print(autocompletes);
Assert.assertEquals("Güntzelstr. (U)", autocompletes.get(0).name);
} }
@Test @Test