cboettig / knitcitations

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

Invalid keys on macOS for references with an umlaut in the author's last name #110

Open krlmlr opened 3 years ago

krlmlr commented 3 years ago

This happens on macOS:

knitcitations:::make_key(citation("duckdb"))$key
#> [1] "M\"uhleisen_2021"

Created on 2021-10-31 by the reprex package (v2.0.1)

On Linux, the key is created correctly:

knitcitations:::make_key(citation("duckdb"))$key
#> [1] "Muhleisen_2021"

Created on 2021-10-31 by the reprex package (v2.0.1)

I suspect the origin of the problem is the different interpretation of "ASCII//TRANSLIT":

iconv("Mühleisen", to = "ASCII//TRANSLIT")
#> [1] "M\"uhleisen"

Created on 2021-10-31 by the reprex package (v2.0.1)

Session info ``` r sessioninfo::session_info() #> ─ Session info ─────────────────────────────────────────────────────────────── #> setting value #> version R version 4.1.1 (2021-08-10) #> os macOS Big Sur 11.6 #> system aarch64, darwin20 #> ui X11 #> language (EN) #> collate en_US.UTF-8 #> ctype en_US.UTF-8 #> tz Europe/Zurich #> date 2021-10-31 #> #> ─ Packages ─────────────────────────────────────────────────────────────────── #> package * version date lib source #> backports 1.2.1 2020-12-09 [1] RSPM (R 4.1.0) #> cli 3.0.1 2021-07-17 [1] CRAN (R 4.1.0) #> crayon 1.4.1 2021-02-08 [1] RSPM (R 4.1.0) #> digest 0.6.28 2021-09-23 [1] CRAN (R 4.1.1) #> ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.1.0) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.1.0) #> fansi 0.5.0 2021-05-25 [1] CRAN (R 4.1.0) #> fastmap 1.1.0 2021-01-25 [1] RSPM (R 4.1.0) #> fs 1.5.0 2020-07-31 [1] CRAN (R 4.1.0) #> glue 1.4.2 2020-08-27 [1] RSPM (R 4.1.0) #> highr 0.9 2021-04-16 [1] CRAN (R 4.1.0) #> htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.1.1) #> knitr 1.36 2021-09-29 [1] CRAN (R 4.1.1) #> lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.1.1) #> magrittr 2.0.1 2020-11-17 [1] RSPM (R 4.1.0) #> pillar 1.6.4.9000 2021-10-25 [1] local #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.1.0) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.1.0) #> R.cache 0.15.0 2021-04-30 [1] RSPM (R 4.1.0) #> R.methodsS3 1.8.1 2020-08-26 [1] RSPM (R 4.1.0) #> R.oo 1.24.0 2020-08-26 [1] RSPM (R 4.1.0) #> R.utils 2.11.0 2021-09-26 [1] CRAN (R 4.1.1) #> reprex 2.0.1 2021-08-05 [1] CRAN (R 4.1.0) #> rlang 0.99.0.9000 2021-10-26 [1] local #> rmarkdown 2.10 2021-08-06 [1] CRAN (R 4.1.0) #> rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.1.0) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.1.0) #> stringi 1.7.5 2021-10-04 [1] CRAN (R 4.1.1) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.1.0) #> styler 1.6.2 2021-09-23 [1] CRAN (R 4.1.1) #> tibble 3.1.6 2021-10-26 [1] local #> utf8 1.2.2 2021-07-24 [1] CRAN (R 4.1.0) #> vctrs 0.3.8 2021-04-29 [1] CRAN (R 4.1.0) #> withr 2.4.2 2021-04-18 [1] CRAN (R 4.1.0) #> xfun 0.26 2021-09-14 [1] CRAN (R 4.1.1) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.1.0) #> #> [1] /Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library ```
cboettig commented 3 years ago

Thanks @krlmlr ! You're completely right, but I'm a bit out of my depth with iconv encodings here -- as you may recall, you provided us with the current implementation: https://github.com/cboettig/knitcitations/commit/c9319f202cd3c58dbf901579487d83885eba7c7b

What do you suggest we do to fix this?