sebastianbarfort/mapDK

Encoding trouble with polling place id's

Closed this issue · 1 comments

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)

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.