Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'll try to explain my problem here. I know that there are many posts dealing with this but I'm still confused.

We have many files from different machines with different systems. The important is:

  1. the tex file will be compiled on a Linux machine with utf-8.
  2. the tex files comes from many Windows machines with iso.

Without converting, is there some good preamble to solve my problem?

For example, on Windows Vista, using Winedt to produce a tex file encoded in iso, is there some package which allows me to run pdflatex on a Linux machine with Kile and utf-8?

This will be a big project with a lot of people sending many tex files to me and I'd like to create a good template with necessary packages to avoid confusions.

share|improve this question
It doesn't matter what machine a file comes from; if it's Latin-1 encoded, just having \usepackage[latin1]{inputenc} in it is sufficient. – egreg Jan 8 '13 at 13:40
I believe that Kile is able to detect the encoding of a file. If you open the Windows file, check that the characters are correct, select all, copy and paste in the window where the UTF-8 file is opened. The machine should do the conversion. Or just decide for one encoding. I believe that recent versions of WinEdt are able to cope with UTF-8, so this would be the best choice. – egreg Jan 8 '13 at 13:48
@egreg can we have multiple encodings,say \include{iso-latin1.tex} and \include{utf-8.tex} in a single project.tex like this ? – texenthusiast Jan 8 '13 at 13:55
Yes, just use \inputencoding{latin1}\input{fileinlatin1}\inputencoding{utf8}. But working with multiple encodings is better avoided. – egreg Jan 8 '13 at 13:57
Better standardize in UTF-8, it is easier in the long run (and I believe current Windows uses it by default now). You can use recode (or a similar command) to change the encoding of the files you get. – vonbrand Jan 19 '13 at 2:33

1 Answer 1

In collaborative projects with source files being edited on a variety of platforms, editors, and locales, encoding issues can become a real PITA.

In such setting, it is best to define one "right", mandatory encoding (UTF-8), communicate this clearly and stick to it. However, in many cases the collaborators, especially if they stem from the Windows or Mac world, do not even know what an encoding is. What, however, works reasonably well in practice, is the following.

  1. Prepare templates that already are in the right encoding, including (if appropriate) the \usepackage[utf8]{inputenc} line. The template also should (at least in some comment), contain some UTF-8 characters: Many modern editors have reasonably good heuristics to detect the encoding "automagically" if non-ASCII characters are present.

  2. Provide editor modelines for as many editors as possible. Many editors, including WinEdt and TeXShop, provide a modeline syntax that can also be used to specify the encoding explicitly. Many other support either the vim or emacs modeline syntax, so those should always be present. But some put additional constraints in this respect: WinEdt, for instance, supports the emacs modeline syntax, but each setting (mode and coding, below) has to be placed in a different line. (Thanks to karlkoeller for correcting this!)

The following document header includes some UTF-8 characters and modeline commands to set the file type (for syntax coloring) to TeX/LaTeX and the encoding to UTF-8 for, respectively: vim, WinEdt, TexShop, Emacs, and Kate:

% vim: set fenc=utf-8 ft=latex
% !Mode:: "TeX:UTF-8"
% !TEX encoding = UTF-8 Unicode 
% -*- mode: latex -*-
% -*- coding: UTF-8 -*-
% kate: encoding utf-8;
% IMPORTANT Note: This file is UTF-8 encoded! 
%                 You should see some umlauts here: ÄÖÜäöü 

The Kate modeline might also work for Texmaker, as both are based on the generic Qt editor component, but I have not checked this. For most editors, modelines have to appear in the first 10 lines of a document, some (Vim, Emacs) also support them at the end of the document (within the last 10 lines).

share|improve this answer
If anybody knows the respective modelines of other editors than the mentioned: Please tell (or edit it into the answer :-) – Daniel Jan 23 '13 at 20:41
OK. It seems that this one was a forgotten (but interesting) question, seeing all people who are upvoting now! – karlkoeller Jun 26 '13 at 9:08
off the (tex-related) topic ... to refer to a coding as “iso” is essentially meaningless -- i regularly work with three iso encodings (iso 646 ~= ascii, iso 88591-1 = iso latin1, and iso 10646 = unicode [with utf-8 encoding]). one might guess that your “iso” means “iso 8859-1”, but the usage is ambiguous and therefore unhelpful. – wasteofspace Jun 26 '13 at 9:23
@wasteofspace: I totally agree and, thus, don't use the term "iso". Maybe your comment was intended for the question? – Daniel Jun 26 '13 at 10:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.