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:
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)?