.Rmd files are saved with other encoding than the default Ubuntu 24.04

Hi,
I use RStudio 2024.12.0+467 "Kousa Dogwood" Release for Ubuntu 24.04. When I create a .Rmd file (notebook), and save it, it is saved with ISO859-1 encoding, but the default is UTF-8:
imagen

I can change the encoding with the option reopen with encoding, I click the option "set as default encoding for source files" , I save the file with the option "save with encoding", choose UTF-8, but after reopening the file, it is opened with the ISO859-1 encoding.
This does not happen when working with RStudio in Windows 11.

How can I change this behavior?

1 Like

If you go to Tools > Global Options ... > Code > Saving > Serialization, what shows up in the "Default text encoding" drop-down? I'm on Mint, and mine defaults to "[Ask]" ... not that I ever get asked. If it's not UTF-8, perhaps changing it there will fix things.

In my case it defaults to UTF-8, but thanks for your response.

How do you determine that the file encoding is ISO859-1? Also, are there non-ASCII characters in the file that might force a funky encoding?

How do you determine that the file encoding is ISO859-1?
Because it appears in the list. RStudio recognizes that the file is encoded this way, so it appears as the first choice (you can see the image in my first post?

Also, are there non-ASCII characters in the file that might force a funky encoding?

only greek letters, accented vowels an the n with tilde (ñ).

If you temporarily replace those letters with something bland like a question mark, does that change anything?

I hesitate to suggest this, because I don't see why it would matter, but when RStudio does inexplicable things it sometimes helps to reset its desktop state.