From ripley at stats.ox.ac.uk  Fri Jan 21 16:57:45 2011
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Fri, 21 Jan 2011 15:57:45 +0000 (GMT)
Subject: [Rd] Windows script editor and locale
In-Reply-To: <1B00FAE3-0417-46E5-94E6-B496A2538116@gmail.com>
References: <1B00FAE3-0417-46E5-94E6-B496A2538116@gmail.com>
Message-ID: <alpine.LFD.2.00.1101211531210.27188@gannet.stats.ox.ac.uk>

There is no support for files in alternative encodings in RGui's 
menus: not to source files nor to load into a pager or the script 
editor.  (I believe all of those long predate any support for 
encodings in R.)

Such provision is rather rare on Windows: files are almost everywhere 
assumed to be in the current Windows codepage (or sometimes WinANSI, 
as in the 'Command prompt' terminal) or in so-called Unicode (usually 
UCS-2LE, possibly UTF-16LE, with a BOM).

I think you could equally ask the same question in reverse: AFAICS the 
R.app GUI has no support for Latin-1 nor UCS-2LE files.  At least in 
our UK experience, the proportion of non-Windows users is so low that 
it is those (including this instructor) who expect to adjust.

What might make some sense is for file.edit() to gain a 'fileEncoding' 
argument so this could at least be done from the command-line.

On Fri, 21 Jan 2011, peter dalgaard wrote:

> Maybe I'm just overlooking something, but I can't figure out how to 
> set/change the locale of a file loaded into the built-in script 
> editor on Windows.
>
> The generic issue is that if I make a teaching script on a Mac, save 
> it to a USB stick, and open it in the script editor in a classroom, 
> then special Danish characters in the comments come out as two-byte 
> sequences, which are pretty unsightly. I know that I can convert the 
> file with iconv (or iconv()), but then I'd have to maintain two 
> copies of the same file for the two operating systems, if I want the 
> students to access it. Would be nice if there was something like a 
> set-coding-system to call up via a menu item.
>
> Any pointers?
>
> -- 
> Peter Dalgaard
> Center for Statistics, Copenhagen Business School
> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
> Phone: (+45)38153501
> Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] Windows script editor and locale
Prof Brian Ripley