Skip to content
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

locale(encoding=) should not strictly rely on iconvlist() #1537

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

bastistician
Copy link

The check_encoding() auxiliary function verifies the specified input encoding via iconvlist()

if (tolower(x) %in% tolower(iconvlist())) {

and rejects any non-listed encoding.

Unfortunately, this unnecessarily breaks locale() on platforms where iconvlist() is incomplete. As ?iconvlist says

On most platforms 'iconvlist' provides an alphabetical list of the
supported encodings. On others, the information is on the man
page for 'iconv(5)' or elsewhere in the man pages

I'd suggest to always accept the portable encodings "latin1" and "UTF-8" and otherwise only give a warning rather than stop if the specified encoding is not found.

This PR also fixes long-standing package check failures on Alpine Linux, e.g.,

--- re-building ‘locales.Rmd’ using rmarkdown
Quitting from lines  at lines 141-166 [unnamed-chunk-12] (locales.Rmd)
Error: processing vignette 'locales.Rmd' failed with diagnostics:
Unknown encoding latin1
--- failed re-building ‘locales.Rmd’

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant