Cannot interpret scandinavian letters

Hi,
After updating R and Rstudio, I am no longer able to read files containing Scandinavian letters (æ,ø,å).

I have a folder "New Folder" that includes the following files and folders:
image

Setting working directory to this folder should allow me to access it's subfolders through Rstudio. However, the special characters are not rendered correctly, and I am not able to access files or folders with these characters.

setwd("C:/Users/andreas/OneDrive - PRIO/Documents/New folder/")
list.files()
[1] "Følkr" "Følkr.txt" "Folkr" "Folkr.txt"
setwd("C:/Users/andreas/OneDrive - PRIO/Documents/New folder/Følkr")
list.files()
character(0)

This has not been a problem before, and I see some signs of others having similar problems:

Any suggestion would be most welcome. Thanks.

sessionInfo()
R version 4.1.2 (2021-11-01)
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.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 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] compiler_4.1.2 generics_0.1.1 tools_4.1.2 Rcpp_1.0.8 cellranger_1.1.0 lubridate_1.8.0 grid_4.1.2 readxl_1.3.1

Hi @andreasft,
Welcome to the RStudio Community Forum.

Maybe the details in this link may help:
https://www.r-bloggers.com/2013/01/r-and-foreign-characters/.

There are also some other things to try in this post:
https://forum.posit.co/t/issues-with-french-text-showing-up-incorrectly-in-r-script-in-rstudio/59896

I tried all solutions mentioned. Same problem persist. Only in the most recent version of Rstudio (2021.09.2 Build 382). I will downgrade Rstudio.

The curious thing is that when using R-Rgui, everything works fine. So this is clearly a Rstudio issue. Many users are reporting the same issue across the message board.

Here is the RGui output for same code:

setwd("c:/users/andreas/OneDrive - PRIO/Documents/New folder/")
list.files()
[1] "Folkr" "Følkr" "Folkr.txt" "Følkr.txt"
setwd("c:/users/andreas/OneDrive - PRIO/Documents/New folder/Følkr")
list.files()
[1] "Folkr.txt" "Følkr.txt"

R version 4.1.2 (2021-11-01)
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.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

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.1.2

I downgraded to RStudio 2021.09.1+372 "Ghost Orchid" Release (8b9ced188245155642d024aa3630363df611088a, 2021-11-08) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36

Now it is working as expected. So clearly something with the most recent 09.2 version. This information in sessionInfo is what differs: "system code page: 65001"

Session info and code:
R version 4.1.2 (2021-11-01)
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.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

loaded via a namespace (and not attached):
[1] compiler_4.1.2 generics_0.1.1 tools_4.1.2 Rcpp_1.0.8 cellranger_1.1.0 lubridate_1.8.0 grid_4.1.2 readxl_1.3.1

setwd("c:/users/andreas/OneDrive - PRIO/Documents/New folder/")
dir()
[1] "Folkr" "Følkr" "Folkr.txt" "Følkr.txt"

setwd("c:/users/andreas/OneDrive - PRIO/Documents/New folder/Følkr")
list.files()
[1] "Folkr.txt" "Følkr.txt"

As i wrote in the other thread:

I have the same problem since I updated to the latest version or R-Studio.

My workaround is to change work directory before running the list.files command, then re-set my real working directory again.

setwd(datadir)
fileslist <- list.files(pattern = "xxx", recursive = TRUE)
setwd(workdir)

Still this is a pretty annoying issue since it forces me to modify code that has been working for years now.
Not the only issue connected to the latest update.

I can report the exact same problem. However, creating the folders with the letters å, ä, or ö from within RStudio works fine. But saving and loading from the folders is not possible.


dir.create("fold_ö")          # Creating folder works fine
var <- 1:10
save(object = var, file = "fold_ö/var.RData")
# Manually move file to fold_ö
load("fold_ö/var.RData")

R version: 4.1.2 (2021-11-01)
RStudio version: 2021.09.2+382 "Ghost Orchid" for Windows
Platform: x86_64-w64-mingw32

Since my University’s OneDrive file path includes the letter “ö”, this is really troublesome for me

Maybe you guys already know this, but it seems like downgrading and workarounds aren’t necessary anymore. This issue is fixed in the latest daily version ("Ghost Orchid" 2021.09.3+385 by the time of writing this).

Cheers!

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.