overdisperse
overdisperse

Reputation: 426

RStudio - Script opened with wrong encoding, how to get back original characters?

I have a file in Spanish, when seen on my teacher's PC a bit of text would display as

regresión cuantílica más

but now that I've opened on mine I see this:

regresión cuantílica más

I have tried "Save with Encoding" to ISO-8859-1 and UTF-8 but it doesn't seem to change anything. Will I need to run some regex replacements on my file or is there a simpler way to fix this?

Upvotes: 0

Views: 811

Answers (1)

user2554330
user2554330

Reputation: 44808

If you have already saved it and you've lost the original version of the file, it will be a pain to recover.

What you should have done when you noticed the bad characters was "Reopen with encoding", and chosen the "UTF-8" encoding. If you can still get the original file, do this now.

If you can't, then you're stuck with lots of manual fixing. Accented characters (and Euro signs, and a few other things) will show up as multi-character sequences. When you recognize one, use search and replace to replace that sequence with the correct character.

Upvotes: 2

Related Questions