fs icon indicating copy to clipboard operation
fs copied to clipboard

`path_real()` garbles non-ascii characters in non-UTF-8 locale

Open jennybc opened this issue 2 years ago • 2 comments

Very similar to #366

On Windows with 4.1.2.

Discovered while starting to poke around https://github.com/r-lib/devtools/issues/2422. All package/project paths are pre-processed with fs::path_real() in usethis, so this bug is quite painful.

library(fs)

dir_create("f\u00F6\u00F6")

(x <- list.files(pattern = "^f"))
#> [1] "föö"

path_abs(x)
#> C:/Users/jenny/AppData/Local/Temp/RtmpyQS9MB/reprex-88c664c3346-vain-paca/föö

path_real(x)
#> C:/Users/jenny/AppData/Local/Temp/RtmpyQS9MB/reprex-88c664c3346-vain-paca/föö

Created on 2022-05-17 by the reprex package (v2.0.1)

jennybc avatar May 17 '22 15:05 jennybc

devtools::as.package() also processes every path through path_real(), so again, pretty painful on Windows + R < 4.2.

jennybc avatar May 17 '22 17:05 jennybc

Coming back from devtools#2422, the issue also persists with R 4.2 for me

clemenskuehn avatar Jun 07 '22 13:06 clemenskuehn