Skip to content

GitHub Action for non-UTF-8 locales#7821

Open
aitap wants to merge 4 commits into
masterfrom
GHA-locales
Open

GitHub Action for non-UTF-8 locales#7821
aitap wants to merge 4 commits into
masterfrom
GHA-locales

Conversation

@aitap

@aitap aitap commented Jul 18, 2026

Copy link
Copy Markdown
Member

Following #7681 (comment): test data.table in the Latin-1 locale (where CE_NATIVE strings should be byte-to-byte equal to CE_LATIN1), GB18030 (which is fully Unicode-compatible, but the mapping from code points to byte sequences is very non-uniform), KOI8-R (which can represent some math symbols but not extended Latin or CJK).

aitap added 4 commits June 6, 2026 14:03
In a non-UTF-8 locale capable of representing a-umlaut, o-umlaut,
u-umlaut, encode from the locale encoding, not UTF-8.
@aitap
aitap requested a review from MichaelChirico as a code owner July 18, 2026 17:17
@aitap aitap changed the title GitHub Actions for non-UTF-8 locales GitHub Action for non-UTF-8 locales Jul 18, 2026
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.01%. Comparing base (94649d5) to head (060f490).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7821   +/-   ##
=======================================
  Coverage   99.01%   99.01%           
=======================================
  Files          88       88           
  Lines       17234    17234           
=======================================
  Hits        17065    17065           
  Misses        169      169           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread inst/tests/tests.Rraw
eval(parse(text = ' # eval(parse()) defers parsing to runtime; see utf8_check description
setnames(x , c("\u00e4", "\u00f6", "\u00fc"))
setnames(y , iconv(c("\u00f6", "\u00fc", "\u00e4"), from = "UTF-8", to = "latin1"))
setnames(y , iconv(c("\u00f6", "\u00fc", "\u00e4"), from = "", to = "latin1"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from="" is the default, better to just omit it

sudo tee /override/R <<EOF # no quotes => expand backticks, dollars
#!/bin/bash
set -o pipefail
exec stdbuf -o L -e L `which R` "\$@" 2>&1 | while read line; do

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we care about AI policy in GHA scripts (cc @jangorecki), which are in .Rbuildignore; here's a recommended alternative:

exec stdbuf -o L -e L $(which R) "$@" 2>&1 | iconv -c -t UTF-8

Based on the feedback:


The wrapper script intercepts R's output and pipes it into a while read line loop. Inside this loop, a new iconv subprocess is spawned for every single line of output.

  • Performance: Spawning a subprocess per line of R CMD check output will add massive overhead and severely slow down the CI run.
  • Buggy Parsing: The read command is missing the -r flag, meaning it will inadvertently mangle and strip backslashes from R's output. Furthermore, using echo "$line" can result in unexpected behavior if a line begins with a flag like -n or -e.

Suggestion: Replace the loop with a single direct pipe. If the author's intent was to prevent iconv from terminating the pipe upon encountering an invalid character, they can use the -c flag (which discards invalid characters) instead of a line-by-line loop

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, it does not impact code of the package its license.

done
EOF
sudo chmod +x /override/R
echo PATH=/override:$PATH >> $GITHUB_ENV

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MichaelChirico MichaelChirico left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be merged as-is, PTAL at the feedback and see what you agree is worth addressing. Thanks!

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.

3 participants