New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read_*() does not work for special characters in file path #371

Closed
strengejacke opened this Issue Apr 24, 2018 · 7 comments

Comments

Projects
None yet
5 participants
@strengejacke
Copy link

strengejacke commented Apr 24, 2018

I can't provide a reprex, I think, but the message should be clear. The problem occurs when the file path contains, e.g., German Umlauts:

test <- read_stata("~/CloudStation/R, diverse/Datensätze zum debuggen/GLES_Vorwahlquerschnitt_ZA5700_v1-0-0.dta")

 Error in df_parse_dta_file(spec, encoding) : 
  Failed to parse C:/Users/Daniel/Documents/CloudStation/R, diverse/Datensätze zum debuggen/GLES_Vorwahlquerschnitt_ZA5700_v1-0-0.dta: Unable to open file. 
4.
stop(structure(list(message = "Failed to parse C:/Users/Daniel/Documents/CloudStation/R, diverse/Datensätze zum debuggen/GLES_Vorwahlquerschnitt_ZA5700_v1-0-0.dta: Unable to open file.", 
    call = df_parse_dta_file(spec, encoding), cppstack = structure(list(
        file = "", line = -1L, stack = "C++ stack not available on this system"), class = "Rcpp_stack_trace")), class = c("Rcpp::exception", 
"C++Error", "error", "condition"))) 
3.
df_parse_dta_file(spec, encoding) 
2.
haven::read_dta(file = path, encoding = enc) at read_write.R#226
1.
read_stata("~/CloudStation/R, diverse/Datensätze zum debuggen/GLES_Vorwahlquerschnitt_ZA5700_v1-0-0.dta") 

Moving the file to a directory without German Umlauts in the file path works.

@sindribaldur

This comment has been minimized.

Copy link

sindribaldur commented May 9, 2018

Same (or similar) issue here on Windows 10, R 3.5.0, and haven 1.1.1

dfg <- read_sav("c:/temp/2017.sav", user_na = TRUE)
file.copy("c:/temp/2017.sav", to = "c:/temp/2017óó.sav", overwrite = TRUE)
[1] TRUE
dfg <- read_sav("c:/temp/2017óó.sav", user_na = TRUE)
Error in df_parse_sav_file(spec, user_na) : 
  Failed to parse c:/temp/2017óó.sav: Unable to open file.
file.rename("c:/temp/2017óó.sav", "c:/temp/2017oo.sav")
[1] TRUE
dfg <- read_sav("c:/temp/2017oo.sav", user_na = TRUE)

EDIT:
The issue was discussed on StackOverflow.

@tzoltak

This comment has been minimized.

Copy link

tzoltak commented Jun 14, 2018

Having the same problem (with read_spss() and with Polish special characters).

@hadley hadley added the bug label Jun 20, 2018

@hadley hadley closed this in 52b11d1 Jun 20, 2018

@hadley

This comment has been minimized.

Copy link
Member

hadley commented Jun 20, 2018

Would be great if someone could confirm this is fixed in the devel version.

@strengejacke

This comment has been minimized.

Copy link

strengejacke commented Jun 20, 2018

My initial issue is solved in the current dev-version! Works for me.

@tzoltak

This comment has been minimized.

Copy link

tzoltak commented Jun 20, 2018

It also works for me!

@bajbaj

This comment has been minimized.

Copy link

bajbaj commented Jun 22, 2018

Import via syntax works, but "import dataset" dialogue in RStudio still gives an error message:

2018-06-22_140748

Windows 10, R 3.5.0, RStudio 1.1.453, haven_1.1.1.9000

@lock

This comment has been minimized.

Copy link

lock bot commented Dec 19, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Dec 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.