I am working with the API from the "Deutsche Bahn" for a small private data science project in R. However, cities with an "Umlaut" such as "Köln" or "München" etc. are cumbersome, since the request with the GET command, i.e.,

url_location <- paste0("https://apis.deutschebahn.com/db-api-marketplace/apis/fahrplan/v1/location/","Koeln")
rd           <- GET(url_location, 
                    add_headers(Accept = "application/json",
                                `DB-Client-Id`     = "client id", 
                                `DB-Api-Key`       = "api key"))

yields entries like K<U+00F6>ln Hbf which I cannot work with.

Question: Is there any option in the GET command (which I could not find) or any alternative which is able to interpret these "Umlaute" appropriately? Or is there a way to substitute these strange "<U+00F6>" parts afterwards?



Browse other questions tagged or ask your own question.