cboettig / knitcitations

:package: Generate citations for knitr markdown and html files
http://carlboettiger.info
Other
220 stars 28 forks source link

utf8ToInt(x) error in write.bibtex #82

Open amitmohanty opened 8 years ago

amitmohanty commented 8 years ago

I am seeing this error on my Windows machine, but not Mac. I am assuming some settings on my Rstudio/R installation with regard to UTF-E encoding is screwed up. I think the output of rcitep(citation("pander")) is causing this problem (the \xf3 ?) If anyone please direct me to the right direction to solve this, that would be great. Thanks.

> library(knitcitations, pander)
> citep(citation("pander"))
[1] "(Dar\xf3czi and Tsegelskyi, 2015)"
> write.bibtex(citation("pander"))
Writing 1 Bibtex entries ... Error in utf8ToInt(x) : invalid UTF-8 string
cboettig commented 8 years ago

Can you show me the output of sessionInfo() too?

On Tue, Aug 18, 2015, 7:11 AM amitmohanty notifications@github.com wrote:

I am seeing this error on my Windows machine, but not Mac. I am assuming some settings on my Rstudio/R installation with regard to UTF-E encoding is screwed up. Any expert advise how to deal with this is much appreciated. Thanks

library(knitcitations, pander) write.bibtex(citation("pander")) Writing 1 Bibtex entries ... Error in utf8ToInt(x) : invalid UTF-8 string

— Reply to this email directly or view it on GitHub https://github.com/cboettig/knitcitations/issues/82.

http://carlboettiger.info

amitmohanty commented 8 years ago

Thanks, Carl. Here it is:

> sessionInfo()
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 States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] knitcitations_1.0.6

loaded via a namespace (and not attached):
 [1] bibtex_0.4.0      bitops_1.0-6      colorspace_1.2-6  curl_0.9.2        devtools_1.8.0   
 [6] digest_0.6.8      ggplot2_1.0.1     git2r_0.11.0      grid_3.1.3        gtable_0.1.2     
[11] htmltools_0.2.6   httr_1.0.0        knitr_1.11        lubridate_1.3.3   magrittr_1.5     
[16] MASS_7.3-43       memoise_0.2.1     munsell_0.4.2     plyr_1.8.3        proto_0.3-10     
[21] R6_2.1.0          Rcpp_0.12.0       RCurl_1.95-4.7    RefManageR_0.8.63 reshape2_1.4.1   
[26] RJSONIO_1.3-0     rmarkdown_0.7     rticles_1.0       rversions_1.0.2   scales_0.2.5     
[31] stringi_0.5-5     stringr_1.0.0     tools_3.1.3       XML_3.98-1.3      xml2_0.1.1       
[36] yaml_2.1.13 
cboettig commented 8 years ago

hmm.. I think that's the right locale for UTF-8 for windows, and the relevant packages look up-to-date enough... I'm afraid I don't have a Windows machine handy to debug though. You have one locale that's still C, you could try setting explicitly:

Sys.setlocale(category = "LC_ALL", locale = "English_United States.1252")