-
Notifications
You must be signed in to change notification settings - Fork 28
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 inserting reference with special characters #74
Comments
I cannot reproduce this error; everything works fine with this citation on my end (See my Here's my whole session: > library(knitcitations)
> cleanbib()
> cite_options(citation_format = "pandoc")
> citet("10.1111/j.1461-0248.2007.01060.x")
[1] "@Broennimann_2007"
> write.bibtex(file="references.bib")
Writing 1 Bibtex entries ... OK
Results written to file 'references.bib'
> sessionInfo()
R version 3.1.3 RC (2015-03-06 r67947)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 8 (jessie)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitcitations_1.0.5 bibtex_0.4.0 RefManageR_0.8.45
loaded via a namespace (and not attached):
[1] bitops_1.0-6 digest_0.6.8 httr_0.6.1 lubridate_1.3.3
[5] memoise_0.2.1 plyr_1.8.1 Rcpp_0.11.5 RCurl_1.95-4.5
[9] RJSONIO_1.3-0 stringr_0.6.2 tools_3.1.3 XML_3.98-1.1
|
Thanks for the quick reply! The problem occurs specifically when calling write.bibtex (which in turn calls RefManageR by @mwmclean ):
I will investigate with locales. You're probably right that's the root of the problem (e.g. see http://stackoverflow.com/questions/5205159/how-can-i-find-out-the-internal-code-representation-of-a-windows-1252-character). I'll let you know if I manage to fix it. Thanks! |
Well, it seems Windows doesn't help to get this sorted... But at least I managed to make it work following your suggestion of changing locales: I paste here the code in case other Windows users find it useful, or someone finds a better solution:
The special characters (ü) are not parsed correctly:
So it's not perfect, but at least works. Thanks again for your help |
No problem. Windows really should have some locale that supports UTF-8 -- On Wed, Mar 18, 2015 at 11:01 AM Francisco Rodriguez-Sanchez <
|
Hi Carl, An update on this issue. I have tried with many references and am not getting an error in Errors still happen when pandoc attempts to produce final pdf with bibliography, in cases when some of the references produced by output: pdf_document bibliography: references.biblibrary(knitcitations)
cleanbib()
cite_options(citation_format = "pandoc") This is a test Referenceswrite.bibtex(file="references.bib") This Rmd is knitted to md successfully but then Rstudio gives the following error: pandoc.exe: Error producing PDF from TeX source When you look at which are causing these errors. Anyway, I just wanted to update you and let you know that I'll come back if I find a solution to this. Feel free to close this issue if you think it's not related to knitcitations anymore. Thanks! |
Guys, was there ever a resolution to this? As @RudolfLi's link shows, this is causing an issue downstream. If there's a workaround, I can implement it in that package? |
Hi, I recall it was a Windows-specific issue, hard to solve because of Windows intrinsic limitations (lots of threads on stack overflow about UTF-8 and Windows). What I tried was post-processing the bibtex references as downloaded by knitcitations to remove the special characters before being processed by pandoc. I paste below the function I made to go over all references and convert problematic fields to UTF-8 (using
Hope this helps somehow. I'd be grateful if you find a solution to this! |
I hit the same issue here today, but I don't quite follow why it's an issue that cannot be resolved. When I run Rename this from .txt to .bib: Janssen_2013.txt # Bad
readLines("Janssen_2013.bib")
# Good
readLines("Janssen_2013.bib", encoding="UTF-8") |
First, thanks a lot for the package - very useful!
Today I found a problem when inserting a reference by DOI. This is my Rmd:
output: pdf_document
bibliography: references.bib
Test:
r citet("10.1111/j.1461-0248.2007.01060.x")
.which gives this error:
Error in utf8ToInt(x) : invalid UTF-8 string
Calls: ... encoded_text_to_latex -> as.vector -> sapply -> lapply -> FUN -> utf8ToInt
Execution halted
I think it may have something to do with the special characters in author names (Müller-Schärer)... Any clue how I could fix this? I couldn't find any help yet.
Many thanks in advance
Paco
My session info:
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitcitations_1.0.5
loaded via a namespace (and not attached):
[1] bibtex_0.4.0 bitops_1.0-6 digest_0.6.8 htmltools_0.2.6 httr_0.6.1
[6] lubridate_1.3.3 memoise_0.2.1 plyr_1.8.1 Rcpp_0.11.5 RCurl_1.95-4.5
[11] RefManageR_0.8.45 RJSONIO_1.3-0 rmarkdown_0.5.1 stringr_0.6.2 tools_3.1.3
[16] XML_3.98-1.1 yaml_2.1.13
The text was updated successfully, but these errors were encountered: