Scandinavian characters in rstudio

Hi,
I had the same problem as described here:

The fix for me was to type
Sys.setlocale(locale="no_NO") in the console (thanks to a helpful colleague).
Just in case someone is still struggling.
I dont know if this breaks something else, but at least i can work with my Norwegian coastal dataset again:)

I have the same issue with RStudio 2022.02.3+492 and R 4.2.0 on Windows 10. Interestingly, RStudio sets the locale to C, while both RGui and R.exe sets the proper locale. I can solve the issue in RStudio by running Sys.setlocale(locale='no_NB.utf8') or Sys.setlocale(locale = 'Norwegian Bokmål_Norway'). This can also be added to ~/.Rprofile for a more permanent fix. Below is the result from sessionInfo() from R.exe and RStudio:

R.exe:

R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] LC_COLLATE=Norwegian Bokmål_Norway.utf8
[2] LC_CTYPE=Norwegian Bokmål_Norway.utf8
[3] LC_MONETARY=Norwegian Bokmål_Norway.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=Norwegian Bokmål_Norway.utf8

RStudio:

R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19043)

Matrix products: default

locale:
[1] C
1 Like

An update to this issue. When I opened an old RStudio project with an object that required a package I had not yet installed, RStudio reset the locale to C, even though I now have set the locale in my ~/.Rprofile file. As soon as I installed the package and restarted the R session (without restarting RStudio), sessionInfo() reported the expected locale. Could this isse be related to this old issue on GitHub: R locale automatically resets to the default one · Issue #9388 · rstudio/rstudio (github.com)?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.