Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have some tex files that are corrupted, meaning that characters like accented letters have been replaced with weird symbols. Is it possible to solve this kind of problem after the weird symbols appear, or is it already too late?

Sometimes when I save some tex files (where the encoding has been set to latin1) and open them again, maybe in some other editors, all the special characters are lost and I need to manually retype them in.

à è ì ò ù

In this example, the five accented letters would be replaced with other symbols, and I haven't found any way to recover the original version of the file.

I know that setting utf8 in the inputenc package solves this problem when I create new files, but what about recovering older latin1 files which, upon opening, are filled with corrupted characters?

share|improve this question
Could you please provide a Minimum Working Example (MWE) that includes all packages dependencies and some text that produces you problem. –  Peter Jansson Jan 12 '13 at 10:20
Tools such as recode or iconv can help. –  Paul Gaborit Jan 12 '13 at 10:22
Your question applies to text files in general; this suggests that it might be easiest to search for such general solutions, using keywords such as "repair", "encoding", "email", "fix", and "text". –  Lover of Structure Jan 12 '13 at 10:24
@user1301428 If you use OSX or Linux, you are lucky. Both include the program iconv which you can use from a terminal with the following syntax iconv -f utf-8 -t latin1 < your-weird-file > new-fixed-file. Alternatively, you can use an editor which properly shows utf8. –  JLDiaz Jan 12 '13 at 12:32
You might also want to check out a konwert tool (is in Ubuntu repo, I don't know about Mac). It is kind of a Swiss-army knife for converting files between encodings, imho better than iconv. Among others, it can (try to) recognize the encoding. –  mbork Mar 20 '13 at 6:34
show 15 more comments

1 Answer

The "weird symbols" most probably are UTF-8 characters displayed in another encoding, and the file itself is fine. Use UTF-8 throughout (set your LOCALE properly in Unix/Linux is probably the most important measure). There are commands like recode that help changing the encoding, but be careful to use them right, they overwrite the original and can mess it up royally.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.