# [OS X TeX] TeXShop 3 and text encoding on Lion - serious problems

Herbert Schulz herbs at wideopenwest.com
Sat Sep 17 13:52:58 CEST 2011

On Sep 11, 2011, at 5:39 AM, Luis Sequeira wrote:

> I am experiencing serious issues with TeXShop and text encodings in Lion.
>
> My wife sent me a tex file written using the mac roman encoding. I opened it, selecting the encoding, as usual, from the dropdown menu in the open dialog.
> The accented characters don't appear. The file typesets correctly - using \usepackage[applemac]{inputenc} - which confirms that the file itself is not corrupted and is using the right encoding.
> Making changes to the file causes havoc, as would be expected - now new accented characters that are input show up correctly in the source but not in the pdf - suggesting that TeXShop is using a different encoding than it is was supposed to.
>
> I then converted the file to utf8 (using Smultron) and replaced applemac by utf8 (\usepackage[utf8]{inputenc}) - and again opened the file from the open dialog, selecting utf8 encoding.
> In this encoding the accented characters still did not display correctly, but still the file typeset ok.
>
> Both versions of the file (using macroman or unicode) display and typeset correctly in TeXShop 2 on Leopard.
>
> I think this is a serious bug in TeXShop in Lion (I am using 3.04, but the same problem occurs in 2.29 in Lion).
> Smultron in Lion (although an old version from 2009) has no problem handling the files. TeXShop 2 in Leopard also has no problem. The same flle displays and typesets perfectly in my wife's iBook.
>
> For now this makes working with accented characters (which are abundant in my language, Portuguese) a nuisance. I am reverting to writing stuff like \'a for á for the first time in years.
>
> Luis Sequeira

Howdy,

The \usepackage[applemac]{inputenc} line tells LaTeX how to interpret the byte stream of the file but it doesn't tell TeXshop how to interpret that same byte stream when it read the file in and displays it in the editor. What is the default encoding you have set up for TeXshop? You can see it in TeXShop->Preferences->Source->Encoding. That is how TeXShop will interpret the byte stream. To guarantee that TeXShop gets the correct encoding place the line

% !TEX encoding = MacOSRoman

(for applemac encoding) near the top of the file.

One more things to note: I believe changing that line to reflect a different encoding (e.g., IsoLatin for latin1 or UTF-8 Unicode for utf8) will NOT change the encoding for the file. Copy/Paste the document to a new file and put in the correct encoding line before saving.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)