Daniel Daniel - 1 year ago 161
R Question

Encoding of German umlauts when using readOGR

I'm trying to read an OGR vector map using the

function provided by the
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")
# [1] L\303\266rrach
# [2] Karlsruhe
# [3] B\303\266blingen
# [4] ...

I've tried to specify an encoding in the
function (
readOGR(dsn = "/path/to/data.gdb", layer = "layer", encoding = "UTF-8"
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
function or R to display the correct German umlauts?

42- 42-
Answer Source

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:

> 'B\303\266blingen'
[1] "Böblingen"
> 'L\303\266rrach'
[1] "Lörrach"

To see the various conventions for R characters, type:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download