Skip to content

Commit

Permalink
Fix bibliography_entries() encoding issue on Windows
Browse files Browse the repository at this point in the history
Resolves #158, #167
  • Loading branch information
mitchelloharawild committed Jul 28, 2021
1 parent bdda9c7 commit 01d8591
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ Imports:
yaml,
tibble,
vctrs (>= 0.3.3),
pillar
pillar,
jsonlite
Suggests:
covr,
rorcid,
Expand Down
6 changes: 4 additions & 2 deletions R/bibliography.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,10 @@ bibliography_entries <- function(file, startlabel = NULL, endlabel = NULL) {
}

# Parse bib file
bib <- rmarkdown::pandoc_citeproc_convert(file)

# Set system() output encoding as UTF-8 to fix Windows issue (rmarkdown#2195)
bib <- rmarkdown::pandoc_citeproc_convert(file, type = "json")
Encoding(bib) <- "UTF-8"
bib <- jsonlite::fromJSON(bib, simplifyVector = FALSE)

# Produce prototype
bib_schema <- unique(vec_c(!!!lapply(bib, names)))
Expand Down

0 comments on commit 01d8591

Please sign in to comment.