westnordost / osmapi-overpass

Java client for the Overpass API
GNU Lesser General Public License v3.0
19 stars 0 forks source link

Problem with Umlauts when querying #3

Closed jmizv closed 1 year ago

jmizv commented 1 year ago

I'm using version 2.0 because 2.1 seems still to be missing in mvnrepository.

implementation 'de.westnordost:osmapi-overpass:2.0'

I have this code for executing a quite simple query.

OsmConnection connection = new OsmConnection("https://overpass-api.de/api/", "jmizv-DataHandler-v0.1");
OverpassMapDataApi overpass = new OverpassMapDataApi(connection);
        try {
            overpass.queryTable("""
                    [out:csv("name")][timeout:90];
                    area["name:de"="Magdeburg"]->.ar;
                    way["highway"]
                      [!"name:etymology:wikidata"]
                       (area.ar);
                    (._;>;);
                    out meta;
                    """, tea -> System.out.println(tea[0]), "\t");
        } catch (Exception ex) {
            ex.printStackTrace(System.err);
        }

But I can see on the console this output:

[..]
Walther-Rathenau-Stra�e
L�neburger Stra�e
Breiter Weg

I fail to see whether I need to set some encoding or whether this is a bug? Maybe solved in 2.1?

Executing this via https://overpass-turbo.eu/ gives the correct encoding.

westnordost commented 1 year ago

What if you do not print it to console but write it into a file?

jmizv commented 1 year ago

Oops, nevermind. Already while debugging I can see it is correct. Encoding is broken while printing to console. So, it's a problem on my side.