tidyxl icon indicating copy to clipboard operation
tidyxl copied to clipboard

special characters in file path

Open py-b opened this issue 2 years ago • 2 comments

Hello,

xlsx_cells is not able to read a file when there are special characters (as "é" in french) in its path.

Here is a reproducible example :

library(tidyxl)

examples <- system.file("extdata/examples.xlsx", package = "tidyxl")

path_with_special_char <- file.path(tempdir(), "é")
dir.create(path_with_special_char)
file.copy(examples, path_with_special_char)

xlsx_cells(file.path(path_with_special_char, "examples.xlsx"))
# Error in xlsx_sheet_files_(path) :
#   Evaluation error: zip file 'C:/Users/XKFZV/AppData/Local/Temp/RtmpU1yg8b/é/examples.xlsx' cannot be opened.

I run this on Window. My sessionInfo :

R version 4.0.5 (2021-03-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server x64 (build 17763)

Matrix products: default

locale:
[1] LC_COLLATE=French_France.1252  LC_CTYPE=French_France.1252    LC_MONETARY=French_France.1252
[4] LC_NUMERIC=C                   LC_TIME=French_France.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] tidyxl_1.0.7

loaded via a namespace (and not attached):
[1] compiler_4.0.5 tools_4.0.5    Rcpp_1.0.8     tcltk_4.0.5

py-b avatar May 21 '22 11:05 py-b

I can't reproduce this error on my Linux device, or in Windows via GitHub Actions. The code that unzips the file is in https://github.com/nacnudus/tidyxl/blob/main/R/zip.R. Please could you try running similar code, to see where the error happens?

nacnudus avatar May 25 '22 21:05 nacnudus

Unzipping the file with your code works fine. So the problem seems to be elsewhere.

I debugged a bit and found out the error mesage occurs in check_sheets, more precisely in xlsx_sheet_files_. Unfortunately, I have not been able to dig further, as I my knowledge on C++ is very limited.

Also note the code of my first message ran successfully on another computer of mine which is Windows too...

py-b avatar Jun 18 '22 18:06 py-b