I want to use python in Rstudio by reticulate. But the non-utf8 characters I use in comments cause an error. For example, when I run, reticulate::repl_python() and then, I run in Python # öngörü I get the following error: Error in gsub(“^\\\\s*|\\\\s*$”, “”, contents) : input string 1 is invalid Warning: In gsub(“^\\\\s*|\\\\s*$”, “”, contents) : unable to translate '# <f6>ng<f6>r<fc>' to a wide string Note that I didn't run gsub() manually. I think R used it in the backend to throw the error message. To solve the problem, I ran the code below, but it didn't work. file.edit(file.path(“~”, “.Rprofile”)) Sys.setlocale(“LC_CTYPE”, locale=“English.65001”) Is there a solution to this problem? Continue reading...