[ESS] Emacs' coding system in R-help buffer.

Martin Maechler maechler at stat.math.ethz.ch
Wed Feb 24 18:48:46 CET 2010


>>>>> "gj" == gerald jean <gerald.jean at dgag.ca>
>>>>>     on Tue, 23 Feb 2010 09:43:24 -0500 writes:

    gj> ess-help-bounces at stat.math.ethz.ch a écrit sur 2010/02/23 05:37:32 :

    >> 
    >> >>>>> "gj" == gerald jean <gerald.jean at dgag.ca>
    >> >>>>>     on Mon, 22 Feb 2010 11:44:14 -0500 writes:
    >> 
    gj> Hello,
    >> 
    gj> I am using ESS-5.7.1 from Emacs 22.3.1 on a 64-bit RedHat
    >> Linux server, R
    gj> 2.10.0, Splus 8.1.1
    >> 
    gj> When I open a R-help buffer from a "*.r" buffer a new buffer
    >> is open and
    gj> the help, for the requested function, is displayed.  But
    >> some characters
    gj> are in a "hard to read" form for human eyes.  For example,
    >> the following is
    gj> a portion of the "history" help file.
    >> 
    gj> 
    >> 
    gj> #############################################################################################

    gj> max.show: the maximum number of lines to show.
    >> â\200\230Infâ\200\231 will
    gj> give all of
    gj> the currently available history.
    >> 
    gj> reverse: logical. If true, the lines are shown in reverse order.
    gj> Note:
    gj> this is not useful when there are continuation lines.
    >> 
    gj> pattern: A character string to be matched against the lines of
    gj> the
    gj> history
    >> 
    gj> ...: Arguments to be passed to â\200\230grepâ\200\231 when doing
    gj> the
    gj> matching.
    gj> 
    >> 
    gj> ###########################################################################################

    >> 
    gj> I am also using Splus for a long time, from ESS, on the same
    >> machine and
    gj> never had this sort of problem.
    >> 
    >> Well, I think S+ (as it is finally called!) does not support
    >> internationalization AFAIK (it may do, using Microsoft concepts
    >> on Windows, but standard ones).
    >> 
    gj> The coding-system for the R-help buffer
    gj> is:
    >> 
    gj> Coding system for saving this buffer:
    gj> Not set locally, use the default.
    gj> Default coding system (for new files):
    gj> 1 -- iso-latin-1 (alias: iso-8859-1 latin-1)
    >> 
    gj> Coding system for keyboard input:
    gj> nil
    gj> Coding system for terminal output:
    gj> u -- utf-8 (alias of mule-utf-8)
    >> 
    gj> Defaults for subprocess I/O:
    gj> decoding: 1 -- iso-latin-1-unix
    >> 
    gj> encoding: 1 -- iso-latin-1-unix
    >> 
    >> etc etc etc
    >> 
    >> The problem in such cases is that  Emacs and R do not agree
    >> about the coding system to use.
    >> 
    >> The above indicates to me, that your Emacs configuration
    >> is preferring iso-latin-1  in some ways,
    >> and I know that R nowadays strongly prefers UTF-8 (Unicode),
    >> of course all depending on the localization aka 'LOCALE' ...
    >> which I know is typically UTF-8 on Redhat.
    >> 
    >> I think .. that Emacs 23.1  may solve such problems somewhat
    >> automatically for you, but I don't know if you can easily
    >> upgrade to that.

    gj> You are right I can't easily upgrad to Emacs 23.1, but if necessary I'll
    gj> try to make a case with our IT people.

    >> Otherwise, you should try to customize your Emacs 22.3 to prefer
    >> Unicode (UTF-8) over ISO-latin-1.

    gj> I did customize Emacs 22.3 to prefer ISO-latin-1 a little while ago because
    gj> I had problems with LaTeX files (I also heavily use LaTeX through Emacs'
    gj> AucTeX) with europeans accents; if I go to UTF-8 will the problems with
    gj> LaTeX come back?

Yes, till you switch using LaTeX with UTF-8 instead of
iso-latin-1.

I would strongly recommend going there. It takes some time,
but it's worth doing, at least for new  *.tex  files.

Basically you need to use
    \RequirePackage[utf8]{inputenc}
instead of 
    \RequirePackage[latin1]{inputenc}

inside some *.sty file that you use  "all the time".

(or use  \usepackage.... directly in your *.tex file)


    >> Alternatively, you change the locale before starting Emacs...

    gj> Here are the defaults locale settings:

    gj> Sys.getlocale("LC_ALL")

    gj> [1] "LC_CTYPE=en_US.UTF-8;
    gj> LC_NUMERIC=C;
    gj> LC_TIME=en_US.UTF-8;
    gj> LC_COLLATE=en_US.UTF-8;
    gj> LC_MONETARY=C;
    gj> LC_MESSAGES=en_US.UTF-8;
    gj> LC_PAPER=en_US.UTF-8;
    gj> LC_NAME=C;
    gj> LC_ADDRESS=C;
    gj> LC_TELEPHONE=C;
    gj> LC_MEASUREMENT=en_US.UTF-8;
    gj> LC_IDENTIFICATION=C"

    gj> can I change them in my bash profile?  If yes which ones should be changed
    gj> and to what values, an example would greatly help.

Yes, you can do that.
I have a collection of  small 'local*foo' files that I can
"source" in (using  ' .  <filename>').

One of them (I no longer use, because it's using ISO-latin1 and
I have long switched to UTF-8) is
this one that uses German language + Switzerland settings,
for most things, but US-english for a few others, notably I want
to keep the decimal "." not use the horrible  "," instead :

--------------------------------------------------------
#! /bin/sh

## Source this file from sh scripts

LANG=de_CH export LANG
LANGUAGE=de_CH export LANGUAGE

  ## LC_ALL=de_CH export LC_ALL
  ## LC_ALL currently (2005-04-05) seems to set all these
  ## we set no LC_ALL, such that users can change them explicitly:

LC_ADDRESS=de_CH export LC_ADDRESS
LC_COLLATE=de_CH export LC_COLLATE #- Sortieren "deutsch" ! 
LC_CTYPE=de_CH   export LC_CTYPE
LC_IDENTIFICATION=de_CH export LC_IDENTIFICATION
LC_MEASUREMENT=de_CH export LC_MEASUREMENT
LC_MESSAGES=de_CH    export LC_MESSAGES
LC_NAME=de_CH        export LC_NAME
LC_PAPER=de_CH       export LC_PAPER
LC_TELEPHONE=de_CH   export LC_TELEPHONE

## but keep these in "US" ~= ASCII:
  ## NB: We still need to use 'LC_ALL=C' in ...
LC_NUMERIC=en_US     export LC_NUMERIC
LC_MONETARY=en_US    export LC_MONETARY
LC_TIME=en_US        export LC_TIME

--------------------------------------------------------


As I said above: I strongly recommend switching everything to
UTF-8  rather than try to make  R  and other apps work nicely
with ISO-latin1.

Martin

    >> Can other Redhat users chime in?
    >> 
    >> Regards,
    >> Martin Maechler, ETH Zurich

    gj> Thanks a lot for your insights Martin,

    gj> Gérald
    >> 
    gj> Both for S+ and R the coding-systems are identical, I ran
    >> diff after saving
    gj> the corresponding coding-systems, no differences???
    >> 
    gj> Any clues?  Thanks,
    >> 
    gj> Gérald Jean
    gj> Conseiller senior en statistiques,
    gj> VP Planification et Développement des Marchés,
    gj> Desjardins Groupe d'Assurances Générales
    gj> télephone            : (418) 835-4900 poste (7639)
    gj> télecopieur          : (418) 835-6657
    gj> courrier électronique: gerald.jean at dgag.ca
    >> 
    gj> "In God we trust, all others must bring data"  W. Edwards Deming
    >> 
    >> 
    >> 
    gj> Le message ci-dessus, ainsi que les documents
    >> l'accompagnant, sont destinés
    gj> uniquement aux personnes identifiées et peuvent contenir des
    >> informations
    gj> privilégiées, confidentielles ou ne pouvant être divulguées.
    >> Si vous avez
    gj> reçu ce message par erreur, veuillez le détruire.
    >> 
    gj> This communication ( and/or the attachments ) is intended for
    gj> named
    gj> recipients only and may contain privileged or confidential
    gj> information
    gj> which is not to be disclosed. If you received this
    >> communication by mistake
    gj> please destroy all copies.
    >> 
    >> 
    >> 
    >> 
    gj> Faites bonne impression et imprimez seulement au besoin !
    gj> Think green before you print !
    >> 
    gj> Le message ci-dessus, ainsi que les documents
    >> l'accompagnant, sont destinés uniquement aux personnes identifiées
    >> et peuvent contenir des informations privilégiées, confidentielles
    >> ou ne pouvant être divulguées. Si vous avez reçu ce message par
    >> erreur, veuillez le détruire.
    >> 
    gj> This communication (and/or the attachments) is intended for
    >> named recipients only and may contain privileged or confidential
    >> information which is not to be disclosed. If you received this
    >> communication by mistake please destroy all copies.
    >> 
    gj> ______________________________________________
    gj> ESS-help at stat.math.ethz.ch mailing list
    gj> https://stat.ethz.ch/mailman/listinfo/ess-help
    >> 
    >> ______________________________________________
    >> ESS-help at stat.math.ethz.ch mailing list
    >> https://stat.ethz.ch/mailman/listinfo/ess-help



    gj> Le message ci-dessus, ainsi que les documents l'accompagnant, sont destinés
    gj> uniquement aux personnes identifiées et peuvent contenir des informations
    gj> privilégiées, confidentielles ou ne pouvant être divulguées. Si vous avez
    gj> reçu ce message par erreur, veuillez le détruire.

    gj> This communication ( and/or the attachments ) is intended for named
    gj> recipients only and may contain privileged or confidential information
    gj> which is not to be disclosed. If you received this communication by mistake
    gj> please destroy all copies.




    gj> Faites bonne impression et imprimez seulement au besoin !
    gj> Think green before you print !

    gj> Le message ci-dessus, ainsi que les documents l'accompagnant, sont destinés uniquement aux personnes identifiées et peuvent contenir des informations privilégiées, confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce message par erreur, veuillez le détruire.

    gj> This communication (and/or the attachments) is intended for named recipients only and may contain privileged or confidential information which is not to be disclosed. If you received this communication by mistake please destroy all copies.

    gj> ______________________________________________
    gj> ESS-help at stat.math.ethz.ch mailing list
    gj> https://stat.ethz.ch/mailman/listinfo/ess-help



More information about the ESS-help mailing list