[Rd] test fails when requesting LC_CTYPE

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Sat May 20 01:29:19 CEST 2017

On RedHat Enterprise Linux 6, the test below fails (this is using the stock
GCC 4.4.7) from R-devel r72707.  LC_CTYPE is unset when I run it, but

It also failed "yesterday" where as far as I recall the test code looked a
bit different.


> ## Results differed by platform, but some gave incorrect results on
string 10.
> ## str() on large strings (in multibyte locales; changing locale may not
work everywhere
> oloc <- Sys.getlocale("LC_CTYPE")
> mbyte.lc <- {
+     if(.Platform$OS.type == "windows")
+       "English_United States.28605"
+     else if(grepl("[.]UTF-8$", oloc, ignore.case=TRUE)) # typically
+       oloc
+     else
+       "C.UTF-8" # or rather "en_US.UTF-8" (? from  system("locale -a|
fgrep .UTF-8") )
+ }
> stopifnot(identical(Sys.setlocale("LC_CTYPE", mbyte.lc), mbyte.lc))
Error: identical(Sys.setlocale("LC_CTYPE", mbyte.lc), mbyte.lc) is not TRUE
In addition: Warning message:
In Sys.setlocale("LC_CTYPE", mbyte.lc) :
  OS reports request to set locale to "C.UTF-8" cannot be honored
Execution halted

	[[alternative HTML version deleted]]

More information about the R-devel mailing list