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

Encoding problem corrupted file #517

Open
adamrobinson361 opened this issue Sep 11, 2020 · 1 comment
Open

Encoding problem corrupted file #517

adamrobinson361 opened this issue Sep 11, 2020 · 1 comment

Comments

@adamrobinson361
Copy link

Expected Behaviour

I am using your package in a package of my own that reads a Power BI reports' underlying json file into R, extracts some data and makes an excel that can be used to support quality assurance of a report e.g. a dropdown for each visual (filters right, right narrative etc.)

In the development of reports a lot of users copy text from word with symbols in.

This loads into R fine but in its code representation when outputted in console. When used with saveData the existence of such text corrupts the file.

I'm looking to understand if anything can be done for these to be written correctly with a specific example below.

Steps to Reproduce the Problem

The following example is the down arrow symbol and if you run this locally you should see it error.

Ideally I'd like the symbol in the output excel. If not I'd like any sort of these characters to be removed (i.e. the ones that cause errors). I do want to keep other characters such as line breaks, *, &, etc.

Any help much appreciated.

x <- "\031"
wb <- openxlsx::createWorkbook()
openxlsx::addWorksheet(wb, "test")
openxlsx::writeData(wb, "test", tibble::data_frame(response = x))
openxlsx::saveWorkbook(wb, "test.xlsx", overwrite = TRUE)

sessionInfo()

R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.4

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

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

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.5      crayon_1.3.4    lifecycle_0.2.0 magrittr_1.5   
 [5] zip_2.1.1       pillar_1.4.6    rlang_0.4.7     stringi_1.4.6  
 [9] renv_0.9.3      rstudioapi_0.11 vctrs_0.3.4     ellipsis_0.3.1 
[13] openxlsx_4.1.5  tools_3.6.2     glue_1.4.2      tinytex_0.25   
[17] xfun_0.16       compiler_3.6.2  pkgconfig_2.0.3 tibble_3.0.3  
@ycphs
Copy link
Contributor

ycphs commented Oct 27, 2020

Could you please create this also at ycphs/openxlsx?

I am maintaining the active fork of the package.

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

2 participants