[R] list.files() not compatible with all Unicode characters; file.exists() is compatible.

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Nov 26 16:39:36 CET 2014

On 25/11/2014 06:53, Prof Brian Ripley wrote:
> On 25/11/2014 01:25, MacQueen, Don wrote:
>> Sorry, your email was undecipherable because you sent HTML formatted
>> email.
>> Please send plain text
> Also, the 'at a minimum' information requested by the posting guide is
> essential here (which OS and locale, in particular).  In general file
> names not in the locale's encoding are unsupported.

An off-list reply indicated this was Windows XP.  Although the message 
body was unreadable, the gist is in the subject line.

 From ?list.files under Windows

   path must specify paths which can be represented in the current

whereas ?file.exists says

   Most of these functions accept UTF-8 filepaths not valid in the
   current locale.

So this is documented behaviour.

[For anyone curious as to why list.files is different: note that it does 
regexp pattern matching.  Adding support for Unicode file paths would 
not be impossible but it would require hundreds of lines of Windows-only 

Brian D. Ripley,                  ripley at stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

More information about the R-help mailing list