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

Error in nchar(hh) : invalid multibyte string when response has Latin1 headers #163

Closed
FlukeAndFeather opened this issue Oct 30, 2021 · 1 comment · Fixed by #164
Closed
Milestone

Comments

@FlukeAndFeather
Copy link
Contributor

Session Info
Session info ───────────────────────────────────────────
 setting  value                       
 version  R version 4.0.4 (2021-02-15)
 os       macOS Big Sur 10.16         
 system   x86_64, darwin17.0          
 ui       RStudio                     
 language (EN)                        
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       America/Los_Angeles         
 date     2021-10-30Packages ───────────────────────────────────────────────
 package     * version date       lib source        
 cachem        1.0.6   2021-08-19 [1] CRAN (R 4.0.4)
 callr         3.7.0   2021-04-20 [2] CRAN (R 4.0.2)
 cli           3.0.1   2021-07-17 [1] CRAN (R 4.0.2)
 crayon        1.4.1   2021-02-08 [2] CRAN (R 4.0.2)
 desc          1.4.0   2021-09-28 [1] CRAN (R 4.0.4)
 devtools      2.4.1   2021-05-05 [2] CRAN (R 4.0.2)
 ellipsis      0.3.2   2021-04-29 [2] CRAN (R 4.0.2)
 fastmap       1.1.0   2021-01-25 [2] CRAN (R 4.0.2)
 fs            1.5.0   2020-07-31 [2] CRAN (R 4.0.2)
 glue          1.4.2   2020-08-27 [2] CRAN (R 4.0.2)
 lifecycle     1.0.1   2021-09-24 [1] CRAN (R 4.0.2)
 magrittr      2.0.1   2020-11-17 [2] CRAN (R 4.0.2)
 memoise       2.0.0   2021-01-26 [2] CRAN (R 4.0.2)
 pkgbuild      1.2.0   2020-12-15 [2] CRAN (R 4.0.2)
 pkgload       1.2.3   2021-10-13 [1] CRAN (R 4.0.4)
 prettyunits   1.1.1   2020-01-24 [2] CRAN (R 4.0.2)
 processx      3.5.2   2021-04-30 [2] CRAN (R 4.0.2)
 ps            1.6.0   2021-02-28 [2] CRAN (R 4.0.2)
 purrr         0.3.4   2020-04-17 [2] CRAN (R 4.0.2)
 R6            2.5.1   2021-08-19 [1] CRAN (R 4.0.2)
 remotes       2.3.0   2021-04-01 [2] CRAN (R 4.0.2)
 rlang         0.4.12  2021-10-18 [1] CRAN (R 4.0.2)
 rprojroot     2.0.2   2020-11-15 [2] CRAN (R 4.0.2)
 sessioninfo   1.1.1   2018-11-05 [2] CRAN (R 4.0.2)
 testthat      3.1.0   2021-10-04 [1] CRAN (R 4.0.4)
 usethis       2.0.1   2021-02-10 [2] CRAN (R 4.0.2)
 withr         2.4.2   2021-04-18 [2] CRAN (R 4.0.4)
 yaml          2.2.1   2020-02-01 [2] CRAN (R 4.0.2)

[1] /Users/frank/Library/R/4.0/library
[2] /Library/Frameworks/R.framework/Versions/4.0/Resources/library

Latin1 encoded headers cause an error on client.R#L526. Can reproduce with rcrossref::cr_cn("10.1126/science.aax9044") (requires registering for the polite pool). Sorry I can't figure out a simpler repro!

FlukeAndFeather pushed a commit to FlukeAndFeather/crul that referenced this issue Oct 30, 2021
Check if headers' encoding is valid in UTF-8 (the default). If not, try Latin1. If still not valid, throw an error with a specific message.
@sckott
Copy link
Collaborator

sckott commented Nov 1, 2021

Thanks, I'll have a look at the PR

@sckott sckott added this to the v1.2 milestone Nov 1, 2021
sckott pushed a commit that referenced this issue Nov 16, 2021
Check if headers' encoding is valid in UTF-8 (the default). If not, try Latin1. If still not valid, throw an error with a specific message.
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

Successfully merging a pull request may close this issue.

2 participants