[OS X TeX] Re: Latexian 1.0 Released

Jonathan Kew jonathan at jfkew.plus.com
Thu Dec 9 19:33:06 CET 2010


On 9 Dec 2010, at 18:06, Claus Gerhardt wrote:

> BBEdit and TextEdit (the newer versions) can detect the encoding of a plain text file when opening it and they are using the corresponding encoding when saving the file. In TextEdit's preferences the default encoding should be set to automatic.

They can not *reliably* detect the encoding of a plain text file; they use various heuristics to make a *guess*. Depending on the contents of the text, this guess may be almost certain, or it may be little more than a reasonable possibility.

Trivial example: using BBEdit, create a file "encoding-test.txt" that contains the text

   What character do you think "Æsop" starts with?

and save it as Window Latin-1. (Imagine a colleague on Windows sent you this as a plain text file.) Then use TextEdit to open that file in "automatic" mode. At least on my Mac (running 10.6.5), it guesses wrong, and the Æ appears as ∆ instead.

Using some form of metadata -- such as the %!TEX encoding = .... line -- to explicitly declare the encoding of the file is much safer than relying on software guesswork. I don't want to rely on some program's guesses to determine the characters that get printed in my documents.

JK




More information about the macostex-archives mailing list