From ripley at stats.ox.ac.uk  Tue Nov  4 18:48:29 2008
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Tue, 4 Nov 2008 17:48:29 +0000 (GMT)
Subject: [Rd] (PR#13195) Can't open files containing russian letters in
 path
In-Reply-To: <4910758F.70702@ksu.ru>
References: <20081022211017.B9BA6282EF48@mail.pubhealth.ku.dk>
	<alpine.LFD.2.00.0811041536060.6161@gannet.stats.ox.ac.uk>
	<4910758F.70702@ksu.ru>
Message-ID: <alpine.LFD.2.00.0811041738170.9449@gannet.stats.ox.ac.uk>

Thanks, I have found the problem.  It is *far* less extensive than you 
claimed, affecting only a couple of menu items.

The problem is the C-level function consolecmd, which was passing Unicode 
characters to storekey.  That used to be correct, but the changes made by 
the Japanese to incorporate their IME had inter alia broken consolecmd in 
non-Latin-1 single byte locales.

This looks like the explanation for the vague problem reported with the 
script editor, which uses consolecmd to submit commands (whereas the pager 
does not).

Note that those file choice dialog boxes are only intended to work in the 
native encoding, so you can only choose a file name in Russian in a 
Russian version of Windows.  That made tracking this down more than a 
little tedious.

On Tue, 4 Nov 2008, Alexey Ivanov wrote:

> Thanks for the attention.
> So my windows locale is Russian (Cyrillic, Win-1251). I installed R-2.8.0-win32.exe. I've got a
> file with Cyrillic letters in its name, for example "C:\???.txt". When I try to open it from R
> menu "File->Source R code ..." it produces an error:
>
>> source("C:\\666.txt")
> Error in file(file, "r", encoding = encoding) :
>  cannot open the connection
> In addition: Warning message:
> In file(file, "r", encoding = encoding) :
>  cannot open file 'C:\666.txt': No such file or directory
>
> the Cyrillic letters "???" in this case are somehow replaced with "666"
>
> Prof Brian Ripley wrote:
>> Can we please have a reproducible example, as well as all the details
>> requested in the posting guide.
>>
>> There are literally tens of different ways to 'open files' in R, and
>> some at least with Cyrillic file names.  Nor is there any obvious
>> difference between 2.8.0 and 2.7.2 patched.
>>
>> On Wed, 22 Oct 2008, asherman at ksu.ru wrote:
>>
>>> Full_Name: Arkady  Sherman
>>> Version: 2.8.0
>>> OS: Windows XP sp3 ntfs file system
>>> Submission from: (NULL) (158.195.166.129)
>>>
>>>
>>> Freshly installed version 2.7.2 works well, but 2.8.0 can't open files
>>> with
>>> russian letters in its names. In error messages the letters are
>>> replaced with
>>> different symbols.
>>>
>>> ______________________________________________
>>> 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] (PR#13195) Can't open files containing russian letters in path
Prof Brian Ripley