Skip to content

Commit 5623b7a

Browse files
authored
tests.Rraw: setlocale(en_US.UTF-8) if not UTF-8 (#6807)
Avoid the warnings on systems where the locale is already UTF-8-compatible (almost all modern systems) but the en_US.UTF-8 locale is missing.
1 parent 032b9c7 commit 5623b7a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

inst/tests/tests.Rraw

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18525,7 +18525,9 @@ rm(.datatable.aware)
1852518525
# tests for trunc.char handling wide characters # 5096
1852618526
local({
1852718527
lc_ctype = Sys.getlocale('LC_CTYPE')
18528-
Sys.setlocale('LC_CTYPE', "en_US.UTF-8") # Japanese multibyte characters require utf8
18528+
# Japanese multibyte characters require utf8. As of 2025, we're likely to be already running in a UTF-8 locale, but if not, try this setlocale() call as a last chance.
18529+
# Unfortunately, there is no guaranteed, portable way of switching to UTF-8 US English.
18530+
if (!l10n_info()$`UTF-8`) Sys.setlocale('LC_CTYPE', "en_US.UTF-8")
1852918531
on.exit(Sys.setlocale('LC_CTYPE', lc_ctype))
1853018532
accented_a = "\u0061\u0301"
1853118533
ja_ichi = "\u4E00"

0 commit comments

Comments
 (0)