[texworks] Editor messes with Latin1 encoded files (Umlaute destroyed)

Bruno Voisin bvoisin at me.com
Wed Jan 6 22:48:43 CET 2010

Le 6 janv. 2010 à 21:39, Matthias Pospiech a écrit :

> If I open a latin1 encoded file (no utf8, created under windows with standard encoding)
> I see all umlaute as wired files. If I correct it and save I see all changed umlaute in another editor
> as utf8 and thus wrong encoding.
> How can I ensure that texworks always opens in the right encoding?

I don't quite see what the problem is.

Most likely your Linux files use ISO Latin 1 encoding, and your Windows files use Windows Roman ANSI encoding (aka codepage 1252). Hence the only thing you have to do is make sure TeXworks uses the proper encoding when opening and saving each file. Otherwise your accents will be damaged once and for good and it will be difficult nay impossible to reproduce backwards the steps having created this, so as to revert the files to their original state.

In TeXworks both encodings are available and called ISO-8859-1 and windows-1252 respectively. You can proceed in two ways:

- Either change TeXworks' encoding pref manually, at Preferences > Editor > Encoding, before opening each file. After the file is opened it's too late, you need to close the file without saving, then set the encoding pref and reopen the file.

- Or you can add at the beginning of the file the appropriate comment telling TeXworks which encoding to use for opening and saving this particular file. As mentioned by one poster, the syntax is, respectively,

	!TeX encoding = ISO-8859-1
	!TeX encoding = windows-1252

And, since you seem to be using LaTeX, you also need to make sure LaTeX interprets the encoding correctly, by writing respectively


Bruno Voisin

More information about the texworks mailing list