Ask coding questions

← Back to all posts
Characters with accent marks not displaying correctly in R
bpadin (0)

Dear community,
I have recently found that in R's new Nix environment, the spanish special characters -like the accented vowels á, é, í, ó, ú, or the letter ñ- do not display properly. In the terminal, "María" appears as "Mar\303\255a", and in the title of a graph, "Distribución" shows up as "Distribuci..n". This didn't use to happen in the older environment. I have tried changing the encoding to UTF-8 in the .Rprofile file, but it doesn't solve the problem.
I would be very grateful if someone could help me fix this issue :)

Comments
hotnewtop
SixBeeps (5629)

You can also provide an encoding or a locale in the function itself. Read this SO post.

bpadin (0)

@SixBeeps Thank you for your answer. I've tried adding fileEncoding="utf8" to the read.table() function, as suggested, but it gets even worse, it won't read the file. And the problem is not only when reading the file, but also when trying to print something directly in the terminal or a graph (like the title).