'Umlaute not displayed correctly with osmdata

I am having troubles with the German Umlaute (ä, ü, ö) and other signs when using osmdata in R.

I can successfully get the data via query (notice the Ü in the bounding box in the first line, it is working fine):

#install.packages("osmdata")
#library(osmdata)

bw <- osmdata::getbb("Baden-Württemberg") %>% 
  osmdata::opq(timeout = 25*100) %>%
  osmdata::add_osm_feature(
    key = "admin_level", 
    value = "4"
  ) %>%
  osmdata::osmdata_sf()

Having a look at the data, one can see that the umlaute aren't displayed correctly.

View(bw$osm_multipolygons)

Consequently, searching by "name" doesn't work anymore:

dplyr::filter(bw$osm_multipolygons, name == "Tirol")
dplyr::filter(bw$osm_multipolygons, name == "Baden-Württemberg")

Tirol is working (no umlaut), Baden-Württemberg (with the ü) isn't.

I'm running R on a German Windows 10, R is running in English.

Best regards



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source