Scripts opened in RStudio can't show unicode characters


I'm running R (version 4.2.3 (2023-03-15) -- "Shortstop Beagle") and RStudio (Version 2023.03.0+386 (2023.03.0+386)) and have some problems reading files with unicode characters. I have not had this issue before, and opening the .R or .Rmd files in native R works well (see attached screenshots). I'm on macOS Monetery (12.5.1).

I've tried saving with encoding UTF-8 but it doesn't help. Any advice on what to do? I feel there are many similar issues and solutions out there but some are outdated and many seen Windows-specific. Thanks so much in advance!

Is the problem

  1. csv file name contains one or more Unicode characters
  2. the header row has one or more
  3. one or more non-header rows has one or more

and what error does the line in the screenshot throw?

Hi, sorry I should have been more clear. The script used to look like the white part of the screenshot. I.e., to read and rename a csv file with unicode characters, I would use unicode characters in the script. Nowadays when I open the script in RStudio (but not base R), the unicode characters are changed. And therefore I can't run the script before I replace all weird characters with the unicode ones. Then I can run the script, but next time I open it I have to redo that step.

Alright, this is solved now! An hour ago I was asked to update to version 2023.03.1+446 (2023.03.1+446) and the problem dissapeared. I can now open .R and .Rmd files with unicode characters and they are displayed correctly in RStudio.

1 Like

This topic was automatically closed 7 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.