I'm trying to read an OGR vector map using the readOGR
function provided by the rgdal
package, but I'm having a little trouble with the German umlauts. I've provided a little example of what the data looks like, umlauts like ö are replaced with \303\266.
map <-readOGR("/path/to/data.gdb", layer = "layer")
map@data$name
# [1] L\303\266rrach
# [2] Karlsruhe
# [3] B\303\266blingen
# [4] ...
I've tried to specify an encoding in the readOGR
function (readOGR(dsn = "/path/to/data.gdb", layer = "layer", encoding = "UTF-8"
or readOGR(dsn = "/path/to/data.gdb", layer = "layer", encoding = "LATIN-1"
), but it looks like it is ignoring the encoding parameter completely, since I'm getting the same result for each encoding I've tried. Does anybody know how I can get the readOGR
function or R to display the correct German umlauts?
Julian is right.
returns the string correctly:
I'm not quite sure what
encoding = "UTF-8/LATIN-1/..."
might do. I would have expected that you would choose one and only one encoding scheme. On my machine I do see the translation of that octal character to the o-umlaut:To see the various conventions for R characters, type:
Besides encodings, there is also the need to have characters in the font being used. The font used in your console display doesn't seem to have the proper mappings for o-umlaut. My default font is Courier. You should also check your locale settings.
?Sys.getlocale
The encoding-parameter is ignored, if iconv is not set to TRUE.