I work with multiple locales/languages on Windows, and after my recent update to R 4.2, I keep seeing a warning " using locale code page other than 65001 ("UTF-8") may cause problems" whenever I try to set the system locale (and regardless of what language I try to set it to).
When I revert back to R 4.1.3, the warning doesn't appear.
Can anyone tell me what this warning means and whether there's anyway to get rid of it? Thanks!
> Sys.setlocale("LC_ALL","English")
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"
Warning message:
In Sys.setlocale("LC_ALL", "English") :
using locale code page other than 65001 ("UTF-8") may cause problems
> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 22000)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
system code page: 65001
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] fansi_1.0.3 assertthat_0.2.1 dplyr_1.0.9 utf8_1.2.2
[5] crayon_1.5.1 grid_4.2.0 R6_2.5.1 DBI_1.1.2
[9] lifecycle_1.0.1 gtable_0.3.0 magrittr_2.0.3 scales_1.2.0
[13] ggplot2_3.3.6 pillar_1.7.0 rlang_1.0.2 cli_3.3.0
[17] generics_0.1.2 vctrs_0.4.1 ellipsis_0.3.2 glue_1.6.2
[21] purrr_0.3.4 munsell_0.5.0 compiler_4.2.0 pkgconfig_2.0.3
[25] colorspace_2.0-3 tidyselect_1.1.2 tibble_3.1.7
>
i have the same issue when building r packages.
I tried running
Sys.setlocale("LC_ALL","English.utf8")
in the rstudio console but when after pressing check in the build pane of Rstudio the packages still fails with this warning/error:
> checking DESCRIPTION meta-information ... WARNING
During startup - Warning message:
Using locale code page other than 65001 ("UTF-8") may cause problems.
ERROR
During startup - Warning message:
Using locale code page other than 65001 ("UTF-8") may cause problems.
This error only occurs in R 4.2.x and not in R 4.1.x
also when trying to change the locale in the console (with administrative privileges) on the latest r patched version does not seem to work:
R version 4.2.1 Patched (2022-07-09 r82572 ucrt) -- "Funny-Looking Kid"
Copyright (C) 2022 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
During startup - Warning message:
Using locale code page other than 65001 ("UTF-8") may cause problems.
Registered S3 method overwritten by 'ROI':
method from
print.constraint PortfolioAnalytics
> Sys.setlocale("LC_ALL","English.utf8")
[1] "LC_COLLATE=English_United States.utf8;LC_CTYPE=English_United States.utf8;LC_MONETARY=English_United States.utf8;LC_NUMERIC=C;LC_TIME=English_United States.utf8"
> sessionInfo()
R version 4.2.1 Patched (2022-07-09 r82572 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8 LC_MONETARY=English_United States.utf8
[4] LC_NUMERIC=C LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] quadprog_1.5-8 lattice_0.20-45 codetools_0.2-18 snow_0.4-4
[5] zoo_1.8-10 foreach_1.5.2 slam_0.1-50 grid_4.2.1
[9] registry_0.5-1 PerformanceAnalytics_2.0.4 PortfolioAnalytics_1.1.0 xts_0.12.1
[13] iterators_1.0.14 tools_4.2.1 ROI_1.0-0 numDeriv_2016.8-1.1
[17] parallel_4.2.1 compiler_4.2.1 doSNOW_1.0.20
Restarting R session...
During startup - Warning message:
Using locale code page other than 65001 ("UTF-8") may cause problems.
> Sys.getlocale()
[1] "LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252"