[latex] How can I compile LaTeX in UTF8?

I did my document in an ISO-standard. It does not support umlaut alphabets, such as ä and ö. I need them. The document gets compiled without UTF8, but not with UTF8. More precisely, the document does not get compiled with the line at the beginning of my main.tex:

\usepackage[utf8]{inputenc}

How can I compile my LaTeX document in UTF8?

This question is related to latex utf-8

The answer is


You needed to iconv your source.

That said, the TEX-based compiler invoked by latex doesn't really support variable-length encodings; it needs big libraries that tell it that certain bytes go together. Xelatex is Unicode-aware and works much better.


Save your file in UTF8 format.

Verify the file format using the following (UNIX) command:

file -bi filename.tex 

You should see:

text/x-tex; charset=utf-8

Convert the file using iconv if it is not UTF8:

iconv --from-code=ISO-8859-1 --to-code=UTF-8 filename.txt > filename-utf.txt

I use LEd Editor with special "Filter" feature. It replaces \"{o} with ö and vice versa in its own editor, while maintaining original \"{o} in tex files. This makes text easily readable when viewed in LEd Editor and there is no need for special packages. It works with bibliography files too.


\usepackage[utf8]{inputenc} will not work for a bibliographic entry such as this:

@ARTICLE{Hardy2007,
author = {Ibn Taymiyyah, A?mad ibn ?Abd al{-}Halim},
title = {Naq? al{-}man?iq},
shorttitle = {Naq? al-man?iq},
editor = {?amzah, A?mad},
publisher = {Maktabat a{l-}Sunnah},
address = {Cairo},
year = {1970},
sortname = {IbnTaymiyyaNaqdalmantiq},
keywords = { Logic, Medieval}} 

For this entry use \usepackage[utf8x]{inputenc}


I have success with using the Chrome addon "Sharelatex". This online editor has great compability with most latex files, but it somewhat lacks configuration possibilities. www.sharelatex.com


Convert your document to utf8. LaTeX just reads your text as it is. If you want to use the utf8 input encoding, your document has to be encoded in utf8. This can usually be set by the editor. There is also the program iconv that is useful for converting files from iso encodings to utf.

In the end, you'll have to use an editor that is capable of supporting utf. (I have no idea about the status of utf support on windows, but any reasonable editor on linux should be fine).