From ripley at stats.ox.ac.uk  Thu May 31 18:50:29 2012
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Thu, 31 May 2012 17:50:29 +0100
Subject: [Rd] possible bug in "R Editor"
In-Reply-To: <CANQBBMuPcZKJHs2+UtSQtNbq9gHXzEg28O7+=TuxHUYOzmPobQ@mail.gmail.com>
References: <CANQBBMuPcZKJHs2+UtSQtNbq9gHXzEg28O7+=TuxHUYOzmPobQ@mail.gmail.com>
Message-ID: <4FC7A155.1090504@stats.ox.ac.uk>

On 31/05/2012 07:04, Wincent wrote:
> Dear all,
>
> I clicked "File-New Script" to open a R Editor, typed some commands in
> it and then saved it to a file. If the location where I tried to save
> the script contained Chinese Character, R Editor complained,
>
> Error: invalid input 'E:\Some.Chinese.Characters\new_file.R' in 'utf8towcs'
>
>
>> sessionInfo()
> R version 2.15.0 (2012-03-30)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
> [2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
> [3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
> [4] LC_NUMERIC=C
> [5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> loaded via a namespace (and not attached):
> [1] tools_2.15.0

It is not a bug in the editor. It may be a bug in iconv or other parts 
of the handling of wide characters in the save routine.  I can see how 
the code can be simplified, but we really need to be able to reproduce 
this, and surely that was not the real example.  (One of the problems is 
that the editor title has to be in the native encoding, so this has to 
be done in a Chinese version of Windows.)

-- 
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] possible bug in "R Editor"
Prof Brian Ripley