# Problem with inputenc

I created a TeX on Ubuntu using Kile. However now I'm working on Windows 10 using TeXnicCenter. Once I tried to compile the same TeX file I got about 80 errors. All the errors were concerned with encoding i.e "Package inputenc error: Unicode char A\expandafter (U+4F1). So I tried to find a solution and I found that using

\inputencoding{latin2}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}


the document compiles (removing any of the above commands, the compiler says there is an error). However, it looks ugly.

Notice the problem with the spanish accent and the weirds "d" and "u" that makes the document to look non-formal.

I will include just a part of the document since it is quite long:

\documentclass[a4paper,12pt,spanish]{article}
\usepackage[utf8x]{inputenc}
\usepackage[spanish,activeacute]{babel}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[T1]{fontenc}
\inputencoding{latin2}
\usepackage{float}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{color}
\usepackage{geometry}

\decimalpoint

\begin{document}

\begin{titlepage}

\begin{center}
\vspace*{-1in}
\begin{figure}[htb]
\begin{center}
\includegraphics[width=1cm]{logo}
\end{center}
\end{figure}

\vspace*{0.15in}
Departamento de Ingenier\'ia   el\'ectrica \\
\vspace*{0.6in}
\begin{large}
Procesamiento digital de se'nales \\
\end{large}
\vspace*{0.2in}
\begin{Large}
\textbf{Tarea 3} \\
\end{Large}
\vspace*{0.3in}
\begin{large}
Miguel Dur\'an D\'iaz  \\
\end{large}
\vspace*{0.3in}
\rule{80mm}{0.1mm}\\
\vspace*{0.1in}
\begin{large}
Profesor: Jorge Pezoa\\

\end{large}
\end{center}

\end{titlepage}

\tableofcontents

\newpage

\section{Problema 1}

A esta tarea se adjunta el archivo Matlab NoisyPixel.mat. Este archivo contiene los
datos medido en un pixel de una cámara infrarroja que toma 30 datos por segundo de un cuerpo uniforme que
está a una temperatura de 26 $^{\circ}$ C. Las mediciones tomadas son ruidosas y siguen el siguiente el modelo:
$$y[n] = 26 + N[n]$$


UPDATE: Opening the TeX File with Notepad++ I note that the document is ANSI-encoded however I want it to be utf-8. How can I solve that ?

• Are you sure your document is encoded in UTF-8 rather than another encoding? (Try to prepare a minimal file and upload it somewhere--not copy and paste--if you'd like someone else to check this.) – ShreevatsaR Nov 3 '17 at 13:16
• It is quite meaningless to say both \inputencoding{latin2} and \usepackage[utf8x]{inputenc}. What is the actual encoding of your input file, Latin2 or UTF-8? You should specify the correct one. – ShreevatsaR Nov 3 '17 at 13:19
• Actually I'm not sure what you mean. When I was working this document (and it was ok) I was using utf-8 on Kile (using Ubuntu). Should I create a small document for this actual work? – Miguel Duran Diaz Nov 3 '17 at 13:19
• @ShreevatsaR I want to use the one that makes the document to work. As far as I know I should use UTF-8 but when I use that, the document doesn't work. – Miguel Duran Diaz Nov 3 '17 at 13:21
• By the way, Latin-2 was meant for Eastern Europe languages, so it's quite surprising to find it in a Spanish document. – egreg Nov 3 '17 at 13:35

The printed letters ǍĄ are a clear indication of utf8 input encoding.

Try to remove

\inputencoding{latin2}


from your source (by commenting it out using a % sign in front of it). You have already

\usepackage[utf8x]{inputenc}


so it should work than.

BTW, the more standard option to inputenc is just utf8, so try also

\usepackage[utf8]{inputenc}

• Using \usepackage[utf8x]{inputenc} (Removing \usepackage[T1]{fontenc} and \inputencoding{latin2} ) Makes TeX to say that there is 705 errors. Using: \usepackage[utf8]{inputenc} TeX says there is 274 errors. – Miguel Duran Diaz Nov 3 '17 at 13:26
• Keep the package fontenc, I did not tell you to remove that one. – jknappen Nov 3 '17 at 13:28
• It is just the same: "Package inputenc error: Unicode Char ólol (U+14A). (It happens when I wrote "sólo". Actually by looking the errors, it seems that it happens with the spanish accent: I removed one spanish accent and I got 257 errors (instead of 258) – Miguel Duran Diaz Nov 3 '17 at 13:32
• Unfortunately, I cannot reproduce your problem with a test file. There is one possibility left: There are latin2 characters left over in the auxilliary files LaTeX has written in its previous runs. Recompile several times to get rid of them. When this does not help, delete all files ending in .aux, .toc, .lot, and .lof and compile again. – jknappen Nov 3 '17 at 13:47

SOLVED: For some reason, the TeX file was encoded using ANSI (probably because of differents OS). So, opening the TeX file with NotePad++ and converting it to UTF-8 makes the document to work. However I must rewrite all the spanish accents.

UPDATED: There was just a conflict between what I wanted and what the TeX was encoding. So, I just changed the option of the TeX editor to make it to encode in UTF8 (it was encoding in ANSI)