Poor UTF-8 support in Rstudio

From R 4.2, R supports utf-8 as native encoding (Upcoming Changes in R 4.2 on Windows - The R Blog). Rstudio (2022.12.0 Build 353) seems to have problems encompassing this.
The following simple plotting code may or may not work, depending on if Rstudio recognizes the utf-8 character Å:

# Make example data.frame
dat <- data.frame(x = 1:10, y = runif(10) * 1:10)
# Plot the data with x-axis label
plot(y ~ x, data = dat, xlab = "År")

The code works without any problem from the R console (4.2.1).
Adding "Sys.setlocale("LC_ALL", "nb-NO.UTF-8")" to your .Rprofile solves the problem, but this should not be necessary. Many users will not be aware of the solution, and spend a lot of time trying to solve the issue. For all that I know, having to manipulate locale may even create problems for some combinations.
I hope Rstudio will improve their utf-8 support.
Thank you.

1 Like

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.