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

unicode literals in README.md are mangled #1294

Closed
kevinushey opened this issue Apr 8, 2020 · 2 comments
Closed

unicode literals in README.md are mangled #1294

kevinushey opened this issue Apr 8, 2020 · 2 comments

Comments

@kevinushey
Copy link
Contributor

kevinushey commented Apr 8, 2020

For example, a README.md containing an (en-dash) is rendered improperly:

project <- file.path(tempdir(), "project")
usethis::create_package(project, open = FALSE)
#> ✔ Creating '/tmp/RtmpWoZa7P/project/'
#> ✔ Setting active project to '/private/tmp/RtmpWoZa7P/project'
#> ✔ Creating 'R/'
#> ✔ Writing 'DESCRIPTION'
#> Package: project
#> Title: What the Package Does (One Line, Title Case)
#> Version: 0.0.0.9000
#> Authors@R (parsed):
#>     * First Last <first.last@example.com> [aut, cre] (<https://orcid.org/YOUR-ORCID-ID>)
#> Description: What the package does (one paragraph).
#> License: `use_mit_license()`, `use_gpl3_license()` or friends to pick a
#>     license
#> Encoding: UTF-8
#> LazyData: true
#> Roxygen: list(markdown = TRUE)
#> ✔ Writing 'NAMESPACE'
#> ✔ Setting active project to '<no active project>'
setwd(project)

writeLines("# Project\nHello – world!", con = "README.md")
pkgdown::build_site()
#> ── Installing package into temporary library ─────────────────────────────────────────────
#> ══ Building pkgdown site ═════════════════════════════════════════════════════════════════
#> Reading from: '/private/tmp/RtmpWoZa7P/project'
#> Writing to:   '/private/tmp/RtmpWoZa7P/project/docs'
#> ── Initialising site ─────────────────────────────────────────────────────────────────────
#> Copying '../../../../Users/kevinushey/Library/R/3.6/library/pkgdown/assets/bootstrap-toc.css' to 'bootstrap-toc.css'
#> Copying '../../../../Users/kevinushey/Library/R/3.6/library/pkgdown/assets/bootstrap-toc.js' to 'bootstrap-toc.js'
#> Copying '../../../../Users/kevinushey/Library/R/3.6/library/pkgdown/assets/docsearch.css' to 'docsearch.css'
#> Copying '../../../../Users/kevinushey/Library/R/3.6/library/pkgdown/assets/docsearch.js' to 'docsearch.js'
#> Copying '../../../../Users/kevinushey/Library/R/3.6/library/pkgdown/assets/link.svg' to 'link.svg'
#> Copying '../../../../Users/kevinushey/Library/R/3.6/library/pkgdown/assets/pkgdown.css' to 'pkgdown.css'
#> Copying '../../../../Users/kevinushey/Library/R/3.6/library/pkgdown/assets/pkgdown.js' to 'pkgdown.js'
#> Writing '404.html'
#> ── Building home ─────────────────────────────────────────────────────────────────────────
#> Writing 'authors.html'
#> ── Building function reference ───────────────────────────────────────────────────────────
#> Writing 'reference/index.html'
#> ══ DONE ══════════════════════════════════════════════════════════════════════════════════

contents <- readLines("docs/index.html")
grep("Hello", contents, value = TRUE)
#> [1] "<p>Hello â\u0080\u0093 world!</p>"

Created on 2020-04-08 by the reprex package (v0.3.0.9001)

Session info
sessioninfo::session_info()
#> ─ Session info ───────────────────────────────────────────────────────────────
#>  setting  value                       
#>  version  R version 3.6.3 (2020-02-29)
#>  os       macOS Catalina 10.15.4      
#>  system   x86_64, darwin15.6.0        
#>  ui       X11                         
#>  language (EN)                        
#>  collate  en_US.UTF-8                 
#>  ctype    en_US.UTF-8                 
#>  tz       America/Los_Angeles         
#>  date     2020-04-08                  
#> 
#> ─ Packages ───────────────────────────────────────────────────────────────────
#>  package     * version    date       lib source                        
#>  assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.0)                
#>  backports     1.1.6      2020-04-05 [1] CRAN (R 3.6.3)                
#>  callr         3.4.3      2020-03-28 [1] CRAN (R 3.6.3)                
#>  cli           2.0.2      2020-02-28 [1] CRAN (R 3.6.2)                
#>  clisymbols    1.2.0      2017-05-21 [1] CRAN (R 3.6.0)                
#>  crayon        1.3.4      2020-03-25 [1] Github (r-lib/crayon@f4bc7b8) 
#>  desc          1.2.0      2018-05-01 [1] CRAN (R 3.6.0)                
#>  digest        0.6.25     2020-04-08 [1] local                         
#>  ellipsis      0.3.0      2019-09-20 [1] CRAN (R 3.6.1)                
#>  evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.0)                
#>  fansi         0.4.1      2020-01-08 [1] CRAN (R 3.6.0)                
#>  fs            1.4.1      2020-04-04 [1] CRAN (R 3.6.3)                
#>  glue          1.4.0      2020-04-03 [1] CRAN (R 3.6.3)                
#>  highr         0.8        2019-03-20 [1] CRAN (R 3.6.0)                
#>  htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.0)                
#>  knitr         1.28       2020-02-06 [1] CRAN (R 3.6.1)                
#>  lifecycle     0.2.0      2020-03-06 [1] CRAN (R 3.6.0)                
#>  magrittr      1.5        2014-11-22 [1] CRAN (R 3.6.0)                
#>  MASS          7.3-51.5   2019-12-20 [1] CRAN (R 3.6.1)                
#>  memoise       1.1.0      2017-04-21 [1] CRAN (R 3.6.0)                
#>  pillar        1.4.3      2019-12-20 [1] CRAN (R 3.6.1)                
#>  pkgconfig     2.0.3      2019-09-22 [1] CRAN (R 3.6.1)                
#>  pkgdown       1.5.0.9000 2020-04-08 [1] Github (r-lib/pkgdown@cb98661)
#>  processx      3.4.2      2020-02-09 [1] CRAN (R 3.6.2)                
#>  ps            1.3.2      2020-02-13 [1] CRAN (R 3.6.2)                
#>  purrr         0.3.3      2019-10-18 [1] CRAN (R 3.6.0)                
#>  R6            2.4.1      2019-11-12 [1] CRAN (R 3.6.0)                
#>  Rcpp          1.0.4      2020-03-17 [1] CRAN (R 3.6.3)                
#>  reprex        0.3.0.9001 2020-02-21 [1] local                         
#>  rlang         0.4.5      2020-03-01 [1] CRAN (R 3.6.0)                
#>  rmarkdown     2.1        2020-01-20 [1] CRAN (R 3.6.0)                
#>  rprojroot     1.3-2      2018-01-03 [1] CRAN (R 3.6.0)                
#>  rstudioapi    0.11       2020-02-07 [1] CRAN (R 3.6.0)                
#>  sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.0)                
#>  stringi       1.4.6      2020-02-17 [1] CRAN (R 3.6.2)                
#>  stringr       1.4.0      2019-02-10 [1] CRAN (R 3.6.0)                
#>  styler        1.3.2      2020-02-23 [1] CRAN (R 3.6.0)                
#>  tibble        3.0.0      2020-03-30 [1] CRAN (R 3.6.2)                
#>  usethis       1.5.1.9000 2020-03-14 [1] Github (r-lib/usethis@6522170)
#>  vctrs         0.2.4      2020-03-10 [1] CRAN (R 3.6.2)                
#>  whisker       0.4        2019-08-28 [1] CRAN (R 3.6.0)                
#>  withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.0)                
#>  xfun          0.12       2020-01-13 [1] CRAN (R 3.6.0)                
#>  yaml          2.2.1      2020-02-01 [1] CRAN (R 3.6.0)                
#> 
#> [1] /Users/kevinushey/Library/R/3.6/library
#> [2] /Library/Frameworks/R.framework/Versions/3.6/Resources/library
@jayhesselberth
Copy link
Collaborator

This is caused by a bug in xml2 that will be fixed in a patch release soon.

@kevinushey
Copy link
Contributor Author

Thanks! I can confirm installing the development version of xml2 fixes this.

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