Skip to content

Commit 315ab54

Browse files
authored
tests: Detect session encoding incapable of U+00F1 (#6567)
iconv() does not necessarily fail to convert U+00F1 to ASCII. For example, FreeBSD iconv() succeeds and returns '?' instead of the character in question. Use identical() to compare the result of the conversion back to the original (which internally converts both to UTF-8).
1 parent 9b8d496 commit 315ab54

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

inst/tests/tests.Rraw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18768,7 +18768,7 @@ if (test_bit64) local({
1876818768
# non-ASCII plain symbol in by, #4708
1876918769
# NB: recall we can't use non-ASCII symbols in the test script. The text is a-<n-tilde>-o (year in Spanish)
1877018770
native_ano = iconv("a\U00F1o", "UTF-8", "")
18771-
if (!is.na(native_ano)) { # #6339: symbol must be represented in native encoding
18771+
if (identical(native_ano, "a\U00F1o")) { # #6339: symbol must be represented in native encoding
1877218772
DT = data.table(a = rep(1:3, 2))
1877318773
setnames(DT, "a", native_ano)
1877418774
test(2266, eval(parse(text=sprintf("DT[ , .N, %s]$N[1L]", native_ano))), 2L)

0 commit comments

Comments
 (0)