[R-SIG-Mac] RE: font encoding issue

Denis Chabot chabotd at globetrotter.net
Sun Feb 13 18:49:13 CET 2005


Last November I enquired about having accents in R console. One of the 
replies was

> Martin Maechler  maechler at stat.math.ethz.ch
>  Wed Nov 24 10:31:14 CET 2004
>
<...>
>
> No, it's not "R itself", since this works in quite a few other
> circumstances in other R consoles: You should be able to use
> accents even in strings and plot them, see
>  > example(text)
> in R, and even in R object names :
>
> E.g. (in a Linux console):
>
>  > Züri <- "exemple à suivre" # à suivre
>  > Züri
>  [1] "exemple à suivre"
>  >
>
> ---------
> However it is -- as you write -- an encoding issue,
> and probably also depending quite a bit on your so
> called "Locale" settings.  To learn more, e.g., see in R
>
>  > apropos("locale")
>  [1] "Sys.getlocale"  "Sys.localeconv" "Sys.setlocale"
>
> and now, e.g.,
>  > ?Sys.getlocale
>
> Here (where I mainly work with Redhat Enterprise Linux) I've
> explicitly turned off the Unicode locale (UTF-8 to be specific)
> and reverted to "C" (or "POSIX"), by at least setting  'LANG=C'
> or 'LANG=POSIX' instead of something like 'LANG=en_US.UTF-8'.
>
> Look at what
>   > Sys.getenv("LANG")
> tells you, and consider
>   > Sys.putenv(LANG = "C")
>
>
> Martin Maechler, ETH Zurich
>
>
Since then I had set locale to C and also LANG to C which allowed me to 
have the symbol for a degree sign to appear correctly in axis labels.

I don't know why but I cannot get this symbol in my plots anymore. I've 
checked and locale and LANG are still set to "C". But running 
example(text) as suggested above produces a plot with all kinds of 
mistakes. All the french accents, for instance, are wrong. I've looked 
at the CRAN archives and some of the posts suggested setting the 
encoding to ISOLatin1 when creating a pdf file. I've tried that too. 
I've even gone back to setting LANG to ISOLatin1, with no success 
either.

Can someone put be back on track, please?

Thanks in advance,

Denis Chabot



More information about the R-SIG-Mac mailing list