[R] New problem printing °C in plots

Martin Maechler maechler at stat.math.ethz.ch
Wed Feb 2 09:58:34 CET 2005


>>>>> "BDR" == Prof Brian Ripley <ripley at stats.ox.ac.uk>
>>>>>     on Tue, 1 Feb 2005 23:33:37 +0000 (GMT) writes:

    BDR> That this prints as an octal escape was always the
    BDR> intention:

excuse me Brian, but "always" is not entirely correct:
Originally (say 6-8 years ago), the intention was really something like

  `` iso-latin-1 (= iso-8859-1) should work everywhere;
     we don't care yet for anything else ''

and this did work for the most important cases of
ESS, console, X11(), postscript()  {but not in some others, IIRC}.


    BDR> it is your OS that is telling R that it is
    BDR> not a printable character.

yes. Patrick: it's really the case that recent versions of Linux
and other OSes AFAIK really behave differently :  They default
to set locales based on UTF-8 whereas before, often locales
where based on iso-* (e.g. iso-8859-1 for "Western Europe"-like).

And even more problematically (if you want to stay back
continuing to use iso-8859-x instead of UTF-8): Man pages and
other files are delivered encoded in UTF-8 as well.
So you are more or less urged to go along with the wave...

    BDR> What locale are you in? For me

    BDR> 1) In en_GB this works (correct, as that is charset
    BDR> ISO-8859-1)

and the same for me with  de_CH  (but *not* with de_CH.UTF-8
which is what Redhat will set in some circumstances when you
tell it that you are in Zurich ...).

    BDR> 2) In C, I get "25\260C" (correct, as that is not an ASCII char)

    BDR> My guess is that you have R running in a C locale and
    BDR> emacs in a UTF-8 locale, since the UTF-8 representation
    BDR> of that symbol is c2b0, in octal \302\260.  If that is
    BDR> what is going on, 1.8.1 would have been equally
    BDR> confused (it might have printed UTF-8, but it would not
    BDR> plot it), so I suspect the important change is not the
    BDR> one you think it is.

    BDR> Note that at least one set of RPMs now runs R in the C
    BDR> locale (but that's not part of R per se).  If you run
    BDR> in en_NZ I think you will find R works to your taste.
    BDR> The good news is that R-devel already supports
    BDR> en_NZ.utf8, and so 2.1.0 will in a couple of months.

    ......

Martin




More information about the R-help mailing list