'Sys.getlocale() fails when called from RStudio
I have a problem with the interaction between Rstudio and R 4.2.0.
When using Sys.getlocale from within the RGui console, it works as expected:
> Sys.getlocale() # from Rgui console
[1] "LC_COLLATE=Norwegian Bokmål_Norway.utf8;LC_CTYPE=Norwegian
Bokmål_Norway.utf8;LC_MONETARY=Norwegian Bokmål_Norway.utf8;LC_NUMERIC=C;LC_TIME=Norwegian
Bokmål_Norway.utf8"
But when using the same from RStudio it gives a different result:
> Sys.getlocale() # from RStudio console
[1] "C"
The rsession-log records the following error message when starting RStudio: ERROR Unable to retrieve user home path. HRESULT: -2147024893; LOGGED FROM: class rstudio::core::FilePath __cdecl rstudio::core::system::userSettingsPath(const class rstudio::core::FilePath &,const class std::basic_string<char,struct std::char_traits,class std::allocator > &,bool) src/cpp/core/system/Win32System.cpp:338
About the environment:
> sessionInfo()
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)
Rstuido version: 2022.02.2 Build 485
Solution 1:[1]
One trick to apparently solve the problem is to change the systems settings on "Regional format" to English (UK). When setting the "Regional format" to Norwegian the same problem persists. But non-ascii letters in data still trigger other encoding problems, so this does not solve the issue completely.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
