[ESS] encoding of i/o in *R* buffer and norwegian letters

Mathieu Basille basille at biomserv.univ-lyon1.fr
Thu Oct 11 19:03:01 CEST 2007


Hello Jarle

I'm not sure what's your problem, however, I don't have this kind of 
problem with Ubuntu 6.10 and Emacs 23 from the depository of Alexandre 
Vassalotti (http://ppa.launchpad.net/avassalotti/ubuntu/).

Everything work in utf-8. I have this line in my .emacs, in the 
custom-set-variables :
  '(current-language-environment "UTF-8")

By default, files are encoded in utf-8, and R as well works in utf-8. 
When I use the expression you gave us :

 > cat("ø\n")

I have the correct behaviour :

 > cat("ø\n")
ø

both from the R buffer directly and from a .R file.

Hope this helps.
Mathieu;
.


Jarle Tufto a écrit :
> Hi,
> 
> I'm having a small problem with norwegian/danish letters and i/o with R 
> when running through ess.  By default, on my ubuntu 7.04 box, R appear 
> to expects i/o encoded as utf-8 (see below).  Emacs and ess, on the 
> other hand, by default, sends i/o to the R session running inside the 
> *R* buffer encoded as latin-1.  I guess this is why the following 
> complete expression (containing the norwegian letter "ø") is interpreted 
> incorrectly as an incomplete expression:
> 
>  > cat("ø\n")
> +
> 
> So to make things work I can change the i/o-setting of the *R* buffer to 
> utf-8 by doing
> 
> M-x set-buffer-process-coding-system
> 
> in emacs.  This solves the problem.  However, if I instead change the 
> encoding used by the running R session to latin1 by doing
> 
>  > options(encoding="latin1")
> 
> the problem is still there:
> 
>  > cat("ø\n")
> +
> 
> Pasting bigger expressions like functions into R with C-c C-f leads to 
> similar even stranger interpretation errors.  So, unless I have 
> misunderstood something, this appears to be a bug.  Any comments?
> 
> Details of my setup are as follows:
> 
>  > sessionInfo()
> R version 2.4.1 (2006-12-18)
> i486-pc-linux-gnu
> 
> locale:
> LC_CTYPE=en_US.UTF-8;LC_NUMERIC=C;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_US.UTF-8;LC_IDENTIFICATION=C
> 
> attached base packages:
> [1] "stats"     "graphics"  "grDevices" "utils"     "datasets"  "methods"
> [7] "base"
> 
> 
> [ess-site.el]: ess-customize-alist=nil
> [ess-site.el _2_]: ess-customize-alist=nil
> (S): ess-s-versions-create making M-x defuns for
> 
> (R): ess-r-versions-create making M-x defuns for
> 
> 
> (R): ess-dialect=nil, buf=*scratch*, start-arg=nil
>   current-prefix-arg=nil
> (inferior-ess 0): ess-start-args=--no-readline
> ess-setq-vars-default 0: ess-language=Initial, -dialect=nil, buf=nil, 
> comint..echoes=nil, comint..sender=comint-simple-send
> ess-setq-vars-default 1: ess-language=S, -dialect=R, buf=nil, 
> comint..echoes=nil, comint..sender=comint-simple-send
> (inf-ess 1): lang=S, dialect=R, tmp-dialect=R, buf=*scratch*
> (inf-ess 1.1): procname=R temp-dialect=R, buf-name=*R*
> (inferior-ess) Method #3 start=/tmp/ buf=*R*
> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, 
> comint..echoes=nil, comint..sender=comint-simple-send
> (inf-ess 2.1): ess-language=S, ess-dialect=R buf=*R*
> (inf-ess 2.2): start args = --no-readline  , 
> inf-ess-start-args=--no-readline
> (inf-ess finish [S(R), R(nil,nil)]
> (ess-multi 0):  inf-ess-start-args=--no-readline  , comint-..echoes=nil
> (i-ess 1): buf=*R*, lang=S, comint..echo=nil, 
> comint..sender=comint-simple-send,
> (i-ess 2): buf=*R*, lang=S, comint..echo=t, 
> comint..sender=inferior-R-input-sender,
> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, comint..echoes=t, 
> comint..sender=inferior-R-input-sender
> (i-ess 3): curr-buf=*R*, comint..echo=t, 
> comint..sender=inferior-R-input-sender,
> (ess-multi post inf-ess: start-args=--no-readline  , comint-echoes=t
> (ess-multi 1):  start-args=--no-readline
> Making Process...Buf *R*, Proc R, Prog R
>   Start File=nil, Args= --no-readline  .
> (R): inferior-ess-language-start=options(STERM='iESS', editor='emacsclient')
> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, 
> comint..echoes=nil, comint..sender=comint-simple-send
> (ess-mode-1): ess-language=S, ess-dialect=R buf=test.r
> (ess-mode-1.5): alist=((ess-local-customize-alist quote 
> R-customize-alist) (ess-dialect . R) (ess-suffix . R) 
> (ess-dump-filename-template ess-replace-regexp-in-string S$ ess-suffix 
> ess-dump-filename-template-proto) (ess-mode-syntax-table . 
> R-syntax-table) (ess-mode-editing-alist . R-editing-alist) 
> (ess-change-sp-regexp . ess-R-change-sp-regexp) (ess-help-sec-regex . 
> ess-help-R-sec-regex) (ess-help-sec-keys-alist . 
> ess-help-R-sec-keys-alist) (ess-loop-timeout . ess-S-loop-timeout) 
> (ess-cmd-delay . ess-R-cmd-delay) (ess-function-pattern . 
> ess-R-function-pattern) (ess-object-name-db-file . ess-r-namedb.el) 
> (ess-imenu-mode-function quote ess-imenu-R) (inferior-ess-program . 
> inferior-R-program-name) (inferior-ess-objects-command . 
> inferior-R-objects-command) (inferior-ess-font-lock-keywords . 
> inferior-ess-R-font-lock-keywords) (inferior-ess-search-list-command . 
> search()
> ) (inferior-ess-help-command . help("%s", htmlhelp=FALSE)
> ) (inferior-ess-help-filetype) (inferior-ess-exit-command . q()) 
> (inferior-ess-exit-prompt . Save workspace image? [y/n/c]: ) 
> (inferior-ess-primary-prompt . \([A-Z][][A-Za-z0-9.]*\)*> ) 
> (inferior-ess-secondary-prompt . + ?) (inferior-ess-start-file) 
> (inferior-ess-start-args . ) (ess-STERM . iESS) (ess-editor . R-editor) 
> (ess-pager . R-pager) (ess-language . S) (inferior-ess-exit-command . q()
> ) (inferior-ess-language-start eval inferior-S-language-start) 
> (comint-use-prompt-regexp-instead-of-fields . t))
> (ess-mode-1.6): editing-alist=((paragraph-start concat \s-*$\| 
> page-delimiter) (paragraph-separate concat \s-*$\| page-delimiter) 
> (paragraph-ignore-fill-prefix . t) (require-final-newline . t) 
> (comment-start . #) (comment-add . 1) (comment-start-skip . #+ *) 
> (comment-column . 40) (indent-line-function quote S-indent-line) 
> (parse-sexp-ignore-comments . t) (ess-set-style . ess-default-style) 
> (ess-local-process-name) (ess-mode-syntax-table . S-syntax-table) 
> (add-log-current-defun-header-regexp . ^\(.+\)\s-+<-[ 	
> ]*function) (font-lock-defaults quote (ess-R-mode-font-lock-keywords nil 
> nil ((46 . w) (95 . w)))))
> (ess-setq-vars-LOCAL): language=S, dialect=R, buf=nil, 
> comint..echoes=nil, comint..sender=comint-simple-send
> 
> Finished setting up ESS-mode.
> 
> 
> Emacs  : GNU Emacs 21.4.1 (i486-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
>   of 2007-08-28 on terranova, modified by Debian
> Package: ess-mode 5.3.6
> 
> current state:
> ==============
> (setq
>   ess-language "S"
>   ess-dialect "R"
>   ess-ask-for-ess-directory t
>   ess-ask-about-transfile nil
>   ess-directory nil
>   ess-keep-dump-files "always"
>   ess-source-directory "/tmp/"
>   )
> 
> 


-- 

¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
                                                 ]
  Mathieu BASILLE -- PhD Student                 ]
                                                 ]
  Laboratoire de Biométrie et Biologie Évolutive ]
  Université Claude Bernard Lyon 1 - France      ]
   http://lbbe.univ-lyon1.fr/                    ]
                                                 ]
  My resume:                                     ]
   http://mathieu.basille.net/pro/               ]
  Habitat web-site:                              ]
   http://biomserv.univ-lyon1.fr/spip_habitat/   ]
________________________________________________]




More information about the ESS-help mailing list