On 29/01/2016 10:35 AM, Daniel Bastos wrote:
Here's how I plot a graph.

   plot(c(1,2,3), main = "graph ç")

The main-string has a UTF-8 character "ç".  I believe I'm using the
windows device.  It opens up on my screen.  (The window says ``R
Graphics: Device 2 (ACTIVE)''.)  How can I tell it to use my encoding of
choice?

As far as I know that's impossible. R uses the system encoding, and I don't think any Windows versions use UTF-8 code pages. They use UTF-16 for wide characters, and some 8 bit encoding for byte-sized characters. R will use whatever 8 bit code page Windows chooses.

I looked around the web for explanations on how to properly tell the
relevant mecanisms that I'm using strings with a partcular encoding when
plotting.  I saw many with my difficulty, but no one seemed to explain
the whole issue.

If you enter the string as a literal, it is not using UTF-8 encoding, it's using the system's 8 bit encoding.


At first I thought I should tell the device.  So I looked at the
documentation for various devices.  I realized only devices such as
postscript, pdf had an encoding parameter.  ``My assumptions must be
wrong'', I thought.  ``Perhaps it's not the device I must tell my
encoding.''

Then I come to you.  Can you point me towards understanding the issue?
You can tell me to read an entire book on encoding, charset and fonts.
I'd like to free myself from such difficulties.

I use R and ESS (GNU EMACS).  (My ESS console says 'U' in the EMACS
modeline.  It means I'm encoding in UTF-8.  I tried '1', ISO-8859-1,
also called Latin-1.)

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to