I've noticed certain packages failing to install from RSPM, while it succeeds for CRAN.
- DistributionUtils
- GeneralizedHyperbolic
- SkewHyperbolic
It seems that, when the original DESCRIPTION
file's Encoding
field is latin1
(or maybe something not UTF-8
), installation fails.
Maybe RSPM (rightfully) changes it to UTF-8 in constructing its own repository, but it's not actually converting the original source files from the stated encoding to the new one.
Can anyone suggest a solid workaround for this?
Test Code:
pkg <- "DistributionUtils"
# [FAILS]
# Error: input string 1 is invalid UTF-8
install.packages(pkg, repos="https://packagemanager.posit.co/cran/latest")
# [SUCCEEDS]
# but cannot use RStudio's Help pane
install.packages(pkg, repos="https://packagemanager.posit.co/cran/latest", INSTALL_opts="--no-docs")
# Returns Encoding="UTF-8"
desc::desc_get("Encoding", file.path(.libPaths()[1], pkg, "DESCRIPTION"))
# [SUCCEEDS]
install.packages(pkg, repos="https://cloud.r-project.org/")
# Returns Encoding="latin1"
desc::desc_get("Encoding", file.path(.libPaths()[1], pkg, "DESCRIPTION"))