Closed gingerYD closed 9 years ago
I had the same problem, and found one way to fix it.
Cause:
In spToGeoJSON.R
, properties are outputed to JSON file by cat
.
For example: cat(",", file=path, append=TRUE, sep="\n")
.
The output file is opened with your system default encoding.
When you run getOption("encoding")
, you'll get [1] "native.enc"
.
And your native.enc
is not utf8
.
That why property strings are converted to wrong encoding.
Solution:
options(encoding = "utf8")
before you run toGeoJSON
.
My suggestion:
file=path
can be replaced by file=connect
, where connect <- file(path, "w", encoding="utf8")
.
Thank you. This solution works!
Thank you!!
Thank you!
Recently I ran an old program that I created six months ago, and encountered an UTF-8 encoding error. It was fine a couple of months ago.
Error in feed_push_parser(buf) : lexical error: invalid bytes in UTF8 string. properties": { "County": "Doña Ana County, New Mexico", "Pop (right here) ------^