-
Notifications
You must be signed in to change notification settings - Fork 238
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
Special Characters in References not rendering correctly #158
Comments
Thanks so much for the fantastic work on the vitae package -- I've really been enjoying using it to semi-automate the construction of my CV. I'm bumping up this issue because I'm having the exact same problem as @fmsabatini myself. I'm on Windows 10, R 4.0.0, and the latest version of pandoc (2.11.4), and the accents in the references of the awesomecv template are not rendering correctly (exactly as in the above screenshot). The encoding error clearly seems to be due to the locale of Windows 10, and it specifically occurs when pandoc is called via I've noted that if I manually change the accents to HTML (e.g. ü -> |
I'm having the same issue, and it's very upsetting because many of my publications are in Spanish. So I decided to do the cleaning after loading the file, directly on the tibble. It is not super elegant, particularly because I have to bypass the nested lists with S3 classes, but for now it works! win2utf <- function(string) {
if (is.null(string) | inherits(string, "csl_dates")) return(string)
if (is.character(string)) {
mapping <- list(
c("é", "é"),
c("ó", "ó"),
c("á", "á"),
c("ü", "ü"),
c("Ã", "í"),
c("Ã�", "Á"),
c("ú", "ú"),
c("ñ", "ñ"),
c("’", "'"),
c("–", '"'),
c("í¶", "ö")
)
for (mapper in mapping){
string <- gsub(mapper[[1]], mapper[[2]], string)
}
} else if (is.list(string)) {
iscsllist <- inherits(string, "list_of_csl_names")
baselist <- map(string, function(string_element) {
if (inherits(string_element, "csl_name")) {
for (cname in names(string_element)) {
string_element[[cname]] <- win2utf(string_element[[cname]])
}
return(string_element)
} else {
return(win2utf(string_element))
}
})
if (iscsllist) {
string <- list_of_csl_names(baselist)
} else {
string <- baselist
}
}
return(string)
}
bibliography_entries("publications_recoded.bib") %>%
mutate(across(everything(), win2utf)) %>%
arrange(author$family, desc(issued)) I manually copy-pasted the wrongly parsed characters in the mapping, but I don't know if they are properly pasted here. Those are just the characters I had in my current list, so it might need expansion... Any idea if there is such a mapping somewhere? |
I have the same problem with Portuguese characters in Windows 10 but not with MacOS or Linux with the same files. |
Bumping with same problem on Windows 10 outputting to PDF through RMarkdown/pandoc/xelatex. Absolutely love the vitae package, thank you so much for creating it. PDF outputs with accented letters in the bib were definitely generating fine Nov of last year (when I got my current job). Mendeley (my ref software of choice) escapes the characters fine in the bib file, e.g. á is {'a} etc. Pulling the bib file in with vitae::bibliography_entries() generates the é characters @montesmariana talks about. Using their brilliant custom function replaces them fine within RStudio, but then they reappear in the PDF knit. |
Could you provide a sample of a bib file which produces this issue? |
Here is the link to my .bib file. If I run it with the win2utf function above, this is what it looks like: I think that I also tried to open the file and save it again with UTF-8 encoding or something like that, but the result is the same as with this file. |
Ran @montesmariana's bib file through my code and same result |
Thanks for the reprex and confirmation. I'm currently hoping for some input on the {rmarkdown} side: rstudio/rmarkdown#2195 It might be an issue with how |
Curiously, that is not a problem in other rmarkdown documents: I can use this same bib file and the references are rendered nicely. |
This should be fixed now. Please try installing the development version of the package and see if it works for you. |
Yes, it works perfectly for me, thank you for your hard work! |
Ditto, thanks so much for the quick fix @mitchelloharawild |
I'm having trouble with my awesomeCV.
After updating to R 4.0.2 it's not rendering my reference list correctly anymore. The special characters (umlaut, apostrophs and so on) are not picked up as UTF-8 symbols.
I spent all morning updating all packages, as well as pandoc. Yet, the references are not displaying as expected:
SessionInfo()
Pandoc Version
I appreciate this is a problem linked to the locale of my Windows 10. I tried to change my locale to UTF-8, but without success
Suggestions?
The text was updated successfully, but these errors were encountered: