sebastianbarfort / mapDK

R package for making maps of Denmark
49 stars 5 forks source link

Encoding trouble with polling place id's #1

Closed fghjorth closed 9 years ago

fghjorth commented 9 years ago

When using mapDK() in Windows, encoding of Danish characters ÆØÅ is messed up. As far as I can tell, this is a really thorny cross-platform issue: changing the encoding can fix the issue on Windows, but will mess the encoding up on Mac.

Suggested solution 1: Only use numeric id's. (Not optimal, since many data sources only provide name id's.)

Suggested solution 2: Convert all name id's to lower case, no Scandinavian letters. For example:

polling$id<-tolower(polling$id)
polling$id<-gsub("æ","ae",polling$id)
polling$id<-gsub("ø","oe",polling$id)
polling$id<-gsub("å","aa",polling$id)
sebastianbarfort commented 9 years ago

I don't know why Windows is having trouble reading UTF-8 encoded ids, but I changed encoding to latin1 which hopefully works across platforms.