Character encoding in TeXShop
Le mercredi 17 septembre 2008 à 23:45 - Lien permanent
It can be a real pain to open files with various character encodings inside TeXShop. Indeed, you basically have to change TeXShop's settings each time.
Hopefully, I recently came across a little-documented feature that allows you to specify the encoding on a per-file basis: you simply add a metadata (a special TeX comment) at the top of the file to set the encoding, and TeXShop will load and save it accordingly. Use:
%!TEX encoding = IsoLatin
for ISO-8859-1 (Latin 1), or:
%!TEX encoding = UTF-8 Unicode
for UTF-8. Be sure to type exactly that, as TeXShop is case-sensitively picky!
Well, that's not bad, but it could be far better:
- why not use the same notation as used by Emacs (and others) :
% -*- coding: UTF-8; -*-?
- why not use standard coding names (
- why does TeXShop need a metadata in the first place? Why can't it directly use the
Update, 2011-05-20: I have written a new note about all TeXShop's magic comments.