Skip to content
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

crash when writing YAML with 'latin1'-encoded strings on Windows #90

Closed
kevinushey opened this issue Sep 18, 2020 · 7 comments
Closed

Comments

@kevinushey
Copy link

To reproduce:

# ok
data <- list(description = enc2utf8("á"))
yaml::write_yaml(data, "test.yml")

# barf
data <- list(description = enc2native("á"))
yaml::write_yaml(data, "test.yml")
@viking
Copy link
Contributor

viking commented Sep 29, 2020

I'll check it out, thanks for the bug report.

@juniperlsimonis
Copy link

I'm trying to get a clean reproducible example but am running into a similar problem when trying

as.yaml(sessionInfo())

depending on which packages are loaded.

I can recreate a sessionInfo object de novo and it won't crash, so there's something weird going on.

I haven't been able to track which one was causing the issue yet, but thanks for the info here @kevinushey on it being around encoding.

@spgarbet
Copy link
Member

Oddly, I just tested the original submission and it now works. The library proving yaml parsing is UTF-8 only is part of the problem.

@spgarbet
Copy link
Member

Currently working in R 4.1.2 with current master head version.

@kevinushey
Copy link
Author

Hmm, it still crashes for me with R 3.6.3 on Windows.

> devtools::session_info(pkgs = "yaml")
- Session info -------------------------------------------------------------------------------------------
 setting  value                       
 version  R version 3.6.3 (2020-02-29)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/Los_Angeles         
 date     2022-02-14                  

- Packages -----------------------------------------------------------------------------------------------
 package * version date       lib source                           
 yaml      2.3.3   2022-02-15 [1] Github (vubiostat/r-yaml@90b6732)

[1] C:/Users/kevin/AppData/Local/R/cache/R/renv/library/test-bd227256/R-3.6/x86_64-w64-mingw32
[2] C:/R/R-3.6.3/library

@kevinushey
Copy link
Author

kevinushey commented Feb 15, 2022

Does the following reproduce more readily?

text <- rawToChar(as.raw(0xe1))
Encoding(text) <- "latin1"
data <- list(description = text)
yaml::write_yaml(data, "test.yml")

@spgarbet
Copy link
Member

That hung my instance of R. I'd like to get all these problems together and introduce as test cases to solve #113

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants