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

gerald.jean at dgag.ca gerald.jean at dgag.ca
Thu Feb 25 17:10:20 CET 2010


Hello Martin,

Martin Maechler <maechler at stat.math.ethz.ch> a écrit sur 2010/02/24
12:48:46 :

> >>>>> "gj" == gerald jean <gerald.jean at dgag.ca>
> >>>>>     on Tue, 23 Feb 2010 09:43:24 -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.
>     >>
....snip

>     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.

A few of the trials I have done:

1.- following your advice I have switched the settings, in the bash_profile
to "fr_CA.utf8", in my .emacs I have set

(prefer-coding-system 'utf-8)

Here is a part of the emacs' help for showing the coding system.

Priority order for recognizing coding systems when reading files:
  1. mule-utf-8 (alias: utf-8)
  2. iso-latin-1 (alias: iso-8859-1 latin-1)
  3. mule-utf-16be-with-signature (alias: utf-16be-with-signature
mule-utf-16-be utf-16-be)
...

In emacs' dired I see french accents correctly used.  The R-help buffer is
garbled???

2.- In the bash_profile I set the languages "LC_.." variables to "fr_CA",
same setting in .emacs then the R-help buffer is fine BUT in dired french
accents are replaced by "\351" for "é" for example and I can't open any
files, from dired, where there is an accent in the date by pressing "f" or
"<enter>", emacs tells me the file doesn't exist anymore.

3.- "fr_CA" in the bash_profile and emacs' defaults in .emacs; then
everything is fine BUT utf-8 is not the first order priority to recognize
coding systems.

Priority order for recognizing coding systems when reading files:
  1. iso-latin-1 (alias: iso-8859-1 latin-1)
  2. mule-utf-8 (alias: utf-8)
  3. mule-utf-16be-with-signature (alias: utf-16be-with-signature
mule-utf-16-be utf-16-be)
...

4.- I also have tried flavors of "en_US.utf8", and without the "utf8" with
similar results??

Don't know what to do with this any more?

Thanks again for your support Martin, it is highly appreciated,

Gérald


>
> 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



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.

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.




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

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.

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.



More information about the ESS-help mailing list