[R] set pdf.options() encoding to UTF-8
David Winsemius
dwinsemius at comcast.net
Thu Aug 27 05:48:39 CEST 2009
On Aug 26, 2009, at 10:55 PM, Liviu Andronic wrote:
> Dear all
> Can anyone point to a list of valid pdf.options() encodings? I checked
> ?pdf and ?postscript, but they do not quite answer my questions. I
> would like to try UTF-8 instead of the default "ISOLatin1.enc" for
> Sweave plots (I have issues with Greek characters in labels).
It's undoubtedly installation specific. The pdf.option page refers us
(at least on my machine) to pdf() which in turn refers to postscript()
which says:
encoding
the name of an encoding file. Defaults to "default". The latter is
interpreted as ‘"ISOLatin1.enc"’ unless the locale is recognized as
corresponding to a language using ISO 8859-{5,7,13,15} or KOI8-{R,U}.
The file is looked for in the ‘enc’ directory of package grDevices if
the path does not contain a path separator. An extension ".enc" can be
omitted.
So I would be looking where it tells me to look:
/Library/Frameworks/R.framework/Versions/2.9/Resources/library/
grDevices/enc
And I see four ISOLatin variants, including ISOLatin2.enc
Obviously that could be different on your machine. I suspect you will
then need to look up details on the list you find. I seem to remember
reading that one of the CP125? encodings was similar to UTF-8 but that
is a very dim memory.
I think that memory might have been regarding this Ripley posting from
2007:
http://finzi.psych.upenn.edu/R/Rhelp02/archive/91924.html
(... and my memory wasn't very accurate.)
My reading of the R-News article suggest that ISOLatin2.enc might be
an option for UTF-8 locales:
http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf
--
David Winsemius, MD
Heritage Laboratories
West Hartford, CT
More information about the R-help
mailing list