Skip to content

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

Closed

Description

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.

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

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions