Unable to set a default encoding for opening files

Hello,

I am using rstudio 1.1.383 in windows 10. I've followed this post to deal with the encoding problem in windows.

My problem is that after setting default text encoding to UTF-8 in Tools-global options-code-savings, rmd files opened from file- open file are still using "system default" encoding to open the file. This is a bit inconvenient because I have to spend a few seconds using reopen with encoding.. to open my file.

Is this an expected behavior or do I miss anything here?

Within Tools -> Global Options... -> Code -> Saving, it's possible to configure the default text encoding for files -- see the Default text encoding: option:

You can also set this on a project-specific basis if preferred, as well. You should be able to change that to UTF-8 -- please let us know if that suffices.

Thanks for your help!. However, the steps in your reply is exactly what I have done: files were saved as UTF-8 as expected.

The problem is that when I open a file, it will be opened using system default encoding, which is CP936. Then, I have to reopen it with UTF-8.

What I want is that rstudio open files with "UTF-8"


Hi, thanks for your help!

I checked again and found that project coding is CP936, which overrides settings in global. Problem solved!

1 Like