[texworks] texworks and encodings

Herbert Schulz herbs at wideopenwest.com
Fri May 20 21:07:09 CEST 2011


On May 20, 2011, at 9:20 AM, Lars Madsen wrote:

> Hi
> 
> where I work some departments have computer labs where they have windows computers with miktex and of course texworks.
> 
> yesterday a student came to me with a problem.
> 
> TeXWorks can easily handle writing in UTF8 or say latin1. But if TeXWorks is configured to save in latin1, and one attempts to open a file written in UTF8, then TeXWorks jumbles the special characters and cannot show them correctly.
> 
> Wouldn't it be possible for TW to detect the encoding and switch to that encoding when working with this file.
> 
> We solved the problem by reconfiguring TW, but for a novice user, this is not something they know about (most users do not understand the concept of encodings)
> 
> /daleif

Howdy,

I believe that programs that determine the input encoding when they open them are using heuristics and too often ``guess'' wrong. I've experienced that with BBEdit and have had to Re-Open with the proper encoding.

The easiest way to have TeXworks (and TeXShop on the Mac too) open any given file with the correct encoding is to place the line

% !TEX encoding = UTF-8 Unicode

or

% !TEX encoding = IsoLatin

near the top of the file. (That is what I use for TeXshop and I'm pretty sure it works for TeXworks too.) For files coming from ``somewhere else'' you need to be informed what the encoding is (if it's from windows I'd assume latin1 (IsoLatin above) or be very careful when you open the file NOT to change it and save it and re-open with the proper encoding.

Good Luck,

Herb Schulz
(herbs at wideopenwest dot com)






More information about the texworks mailing list