![]() |
File Encoding |
About string encoding
There is actually no way of guessing the encoding of a given text file. The implementation in iTeXMac is not as strong as a macintosh user would expect. You can safely use the pull down menus in the open panel but changing the encoding before saving may lead to some information loss.
Encodings are meant to be used in conjunction with latex2e packages:
\usepackage[applemac]{inputenc} for mac os roman encoding \usepackage[cp1252]{inputenc} for windows latin 1 encoding (code page 1252) \usepackage[latin1]{inputenc} for ISO latin 1 encoding (ISO8859-1) |
It would have been nice if iTeXMac could parse the latex files and recognize the encoding just reading the inputenc package option. But problems surely occur for splitted files.
Opening Files: When opening a file, you can check the automatic box. In that case, iTeXMac parses the header of the file to find such a commented line:
% !iTeXMac(charset): blah |
If there is no such line or if the blah encoding is not recognized, iTeXMac will use the encoding selected in the menu or in the defaults.
If you do not check the automatic box when opening a file, you can provide from the pull down button a character encoding for opening and reading the source files. If you do not provide an encoding, iTeXMac will use the preferred one. This is useful when you open a file from another platform for the first time, provided that you know what encoding is used.
The encoding used to read a file will be used to write it back, except when changes are made via the Format appropriate menu item. You can see the encoding used for the current file under the format menu as a checked item.
When the encoding chosen to open a source file is not the preferred one, you should add a commented line in your file header as described above in order not to forget it. This is particularly useful when you are to work on the same TeX file from different platforms.
If you do not know what encoding is used: If you cannot guess the string encoding used in a file (for example if it comes from the web), you can still open it choosing an arbitrary encoding then try the other available string encodings through the menu item Format:String Encodings: Revert With:... until one of them matches.
Saving Files: When saving a file, the encoding used is the one specified in the source file when the automatic option is checked, and the one given by the Format sub menu otherwise. When problems occur, the preferred encoding is used..
Changing file encoding does not really mean file filtering. There is in general some problem on unknown characters.
Known char sets: iTeXMac implementation of string encoding is a straightforward use of built in Mac OS X facilities, it will perhaps not fit your needs... so be careful. Recognized charset's that may appear in the %\iTeXMac(charset):... declaration are
mac
os roman ascii non lossy ascii nextstep latin iso-8859-1 code page 1252 cp 1252 windows latin 1 |
Other codes are described in