[R-sig-Geo] plotKML with multi-lingual output

Anthony Fischbach afischbach at usgs.gov
Fri Feb 7 22:05:02 CET 2014


Tom, 
Trying to set the locale to 'ru_RU.UTF-8' seems to hit a Windows specific
issue.
When I enter
>Sys.setlocale(category='LC_CTYPE', locale='ru_RU.UTF-8')
I receive this error.
[1] ""
Warning message:
In Sys.setlocale(category = "LC_CTYPE", locale = "ru_RU.UTF-8") :
   OS reports request to set locale to "ru_RU.UTF-8" cannot be honored

Yet, when I enter
>Sys.setlocale(category='LC_CTYPE', locale='Russian_Russia.1251')  
I recieve this.
[1] "Russian_Russia.1251"

Yet, I still am unable to write the Cyrillic characters.
In my toy example posted above, I may see the field name 
> names(big)[6]
I see the following on my screen.
[1] "Русское.название"
Yet, when I write this to a text file using the sink() function, I get the
following in my text file.
[1] "Ðóññêîå.íàçâàíèå"
>From this I deduce that my problem is not with plotKML, but with locale
encoding handling within R on my Windows machine.

When I try to set the encoding directly using the 
Encoding(names(big)[6])<-'UTF-8'
Then send the result (names(big)[6]) to a text file using the sink()
function, I get
[1] "<d0><f3><f1><f1><ea><ee><e5>.<ed><e0><e7><e2><e0><ed><e8><e5>"

Is see that use of a file connection
(http://stat.ethz.ch/R-manual/R-patched/library/base/html/connections.html)
may enable direct handling of the encoding.
Would it be possible to utilize the encoding flag within the file function
to enable encoding of non-Roman letters written to a KML?  Or would this
require reference to the function XML::saveXML(tr, f, encoding = "UTF-8")
within your plotKML functions?



-----
Tony Fischbach, Wildlife Biologist
Walrus Research Program
Alaska Science Center
U.S. Geological Survey
4210 University Drive
Anchorage, AK 99508-4650

AFischbach at usgs.gov
http://alaska.usgs.gov/science/biology/walrus
--
View this message in context: http://r-sig-geo.2731867.n2.nabble.com/plotKML-with-multi-lingual-output-tp7585705p7585727.html
Sent from the R-sig-geo mailing list archive at Nabble.com.



More information about the R-sig-Geo mailing list