[R-SIG-Mac] Unicode characters in script?

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Aug 12 08:23:03 CEST 2011


On Thu, 11 Aug 2011, Simon Urbanek wrote:

>
> On Aug 11, 2011, at 2:35 PM, Michael Hoban wrote:
>
>> Hi all-
>>
>> I tried searching before posting, but this is one of those tricky
>> questions to search for. My issue is this: within the R.app gui, I can
>> use extended characters in plot labels without any issue (specifically
>> in my case the ∂, lowercase delta), for example:
>>
>>> plot(c(1:10) ~ c(1:10), main="∂foobie bletchƒ")
>>
>> However, when I try to do the same in a script from the terminal
>> (interpreted by Rscript), I get a bunch of errors related to character
>> encoding:
>>  ....
>>  conversion failure on '∂foobie bletchƒ' in 'mbcsToSbcs': dot
>> substituted for <e2>
>>  ....
>>
>> Is there a way to make this work? Or is Rscript not equipped to handle
>> multibyte characters?
>>
>
> It seems your'e running Rscript in a locale that doesn't support 
> unicode (probably C). Make sure you use UTF-8 locale (e.g. 
> LANG=en_US.UTF-8)

Maybe: but because he blatently ignored the posting guide, we don't 
know.

Another possibility is that he is using a graphics device that does 
not support those characters (and again, we have not been told).

Using Greek characters requires the postscript() and pdf() devices to 
be told to work in Greek, as their help pages (and the R manuals) 
makes clear.  It is those graphics languages (and not Rscript) which 
do not support Unicode.  You will also need viewers that support the 
Greek characters ....


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


More information about the R-SIG-Mac mailing list