Nissim Kaufmann
2014-Nov-24 19:07 UTC
[R] list.files() not compatible with all Unicode characters; file.exists() is compatible.
Hello,I have some files with strange Unicode characters in their names that I am trying to remove.But list.files() does not return their names faithfully so that I can deal with them.> list.files()[1] "? text.txt" ? ? ? ? ? ? ? ? ?<--- here you should see a question mark, a space, then text.txt> file.exists("? text.txt") ? ?<----by copying and pasting the output from above[1] FALSE> file.exists('? text.txt') ? ?<--- here you should see a black triangle, what looks like a space, and text.txt[1] TRUEDocumentation for file.exists() and file.access() do not seem to discuss this. The file name has these Unicode characters:BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR U+23EF BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE VERTICAL BAR ?BLACK RIGHT-POINTING TRIANGLE U+25B6 BLACK RIGHT-POINTING TRIANGLE ? Thank you!CheersNissim KaufmannNSOL.altervista.org [[alternative HTML version deleted]]
MacQueen, Don
2014-Nov-25 01:25 UTC
[R] list.files() not compatible with all Unicode characters; file.exists() is compatible.
Sorry, your email was undecipherable because you sent HTML formatted email. Please send plain text -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 11/24/14, 11:07 AM, "Nissim Kaufmann" <nissimkaufmann at yahoo.com> wrote:>Hello,I have some files with strange Unicode characters in their names >that I am trying to remove.But list.files() does not return their names >faithfully so that I can deal with them. >> list.files()[1] "? text.txt" <--- here you should see >>a question mark, a space, then text.txt> file.exists("? text.txt") >><----by copying and pasting the output from above[1] FALSE> >>file.exists('? text.txt') <--- here you should see a black triangle, >>what looks like a space, and text.txt[1] TRUE >Documentation for file.exists() and file.access() do not seem to discuss >this. >The file name has these Unicode characters:BLACK RIGHT-POINTING TRIANGLE >WITH DOUBLE VERTICAL BAR U+23EF BLACK RIGHT-POINTING TRIANGLE WITH DOUBLE >VERTICAL BAR ?BLACK RIGHT-POINTING TRIANGLE U+25B6 BLACK RIGHT-POINTING >TRIANGLE ? >Thank you!CheersNissim KaufmannNSOL.altervista.org > [[alternative HTML version deleted]] > >______________________________________________ >R-help at r-project.org mailing list >https://stat.ethz.ch/mailman/listinfo/r-help >PLEASE do read the posting guide >http://www.R-project.org/posting-guide.html >and provide commented, minimal, self-contained, reproducible code.
Prof Brian Ripley
2014-Nov-25 06:53 UTC
[R] list.files() not compatible with all Unicode characters; file.exists() is compatible.
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. -- 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