Encoding of German umlauts when using readOGR

早过忘川 提交于 2019-12-05 01:34:18

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:

?Quotes

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

Julian is right.

file_name <- "../gis_data/bw/AX_KommunalesGebiet.shp"
shape_kommunal <- readOGR(file_name, layer = "AX_KommunalesGebiet", use_iconv = TRUE, encoding = "UTF-8")
data_kommunal <- shape_kommunal@data
head(data_kommunal)

returns the string correctly:

  GKZ                NAME
0 08236074           Kämpfelbach
1 08425052           Grundsheim
2 08435067           Deggenhausertal

The encoding-parameter is ignored, if iconv is not set to TRUE.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!