# File encoding for UTF8 arabic fonts

In my definition I have

\documentclass[a4paper,11pt]{article}
\usepackage[utf8, utf8x]{inputenc}
\usepackage[english, ngerman]{babel} % Sprache
%\usepackage[T1]{fontenc}
\usepackage{newunicodechar}


The above configuration gets rid of errors from

• missing Umlaut
• incorrect recognition of IED´s

removing the declarations transform the content properly but misses äöü - the German Umlaut. Now I have the following the following error:

Package ucs Error: Unknown Unicode character 1589 = U+0635,(ucs) possibly declared in uni-6.def. ...�ن ريکشا در چاريکار: تص


Any hint what to configure to get rid of the mentioned error?

• do you have to use pdftex. If using a non latin script it is much easier to use luatex or xetex and opentype fonts – David Carlisle Dec 5 '18 at 16:12
• I don't get the q completly. I want to have some kind of output which will be finally a PDF one. i.e. a PDF-file should be generated from the input. If there are other option for conversion - I am happy to get some knowledge. – LeO Dec 6 '18 at 7:48
• as you have given so few clues about your current document it is hard to help, but pdftex is limited to 8-bit fonts with at most 256 characters which makes using non-latin scripts tricky to set up, the xetex and luatex variants use Unicode and Opentype fonts the same as your browser or word processor would use so there is a much greater range available and as they use unicode natively you do not need inputenc or ucs or other macro packages to handle the file encoding there should be lots of examples on this site look at a few of tex.stackexchange.com/search?q=xetex+arabic – David Carlisle Dec 6 '18 at 8:06
• Thx - I'll take a look. The main purpose we have here is to convert a HTML file into a PDF one. I know there are packages out there. But since we need to intercept some special cases we approach via TeX (LaTeX) to handle the final output and we treat the input. Therefore we have a file as input which have many different encoded characters. But thanx for pointing out to xetex or luatex which I'll check. – LeO Dec 6 '18 at 8:41
• Your title mentions Arabic fonts, but it’s not clear to me how they relate to your question? – Davislor Dec 6 '18 at 15:43

If you must use PDFTeX, I would recommend the following, for Western European languages:

\documentclass[a4paper,11pt]{article}
\usepackage[T1]{fontenc}
\usepackage{textcomp} % For the TS1 encoding.
\usepackage[utf8]{inputenc} % The default since 2018
\usepackage[english, ngerman]{babel}
\usepackage{newunicodechar}

\begin{document}
\selectlanguage{ngerman}
Küsse die schönen Bären!
\end{document}


The reason umlauts weren’t working for you was that you commented out the line \usepackage[T1]{fontenc}, which selects the legacy, 8-bit Cork encoding. (To get full support for Western European languages, also load the text companion encoding with textcomp.) Without that, you fell back to the even more obsolete 7-bit OT1 encoding, which does not support German.

However, if you’re allowed to use a modern TeX engine, I recommend this instead:

\documentclass[a4paper,11pt]{article}
\usepackage{fontspec}
\usepackage[english, ngerman]{babel}

\begin{document}
\selectlanguage{ngerman}
Küsse die schönen Bären!
\end{document}


This allows you to use Unicode directly, along with all the fonts your word processor can. In particular, if you want to use Arabic, your life will be much, much easier if you use XeLaTeX and fontspec. Your output will still be in PDF format unless you specify otherwise.

• The first setting results in the same error as previously mentioned, i.e. the characters of this font are not translated. Compiling XeLaTeX and LuaLaTeX translates the German Umlaut and gets rid of the inital errors. Nevertheless I don't see them encoded in the resulting PDF-file. Which raises the q if I need to add something more to the definition? Or do I need to escape (?) the chars? Or...? – LeO Dec 10 '18 at 8:32
• @LeO Make sure you save the file as UTF-8. It will then work in PDFLaTeX. – Davislor Dec 10 '18 at 8:38
• @LeO You could also use selinput to autodetect the encoding, but in 2018, you should just use UTF-8 for new documents. – Davislor Dec 10 '18 at 8:39