[Tex/LaTex] This error keeps appearing: ! Package inputenc Error:Keyboard character used is undefined in inputencoding ansinew

errorsinput-encodings

I have been working on this document without problem, but now everytime I compile it, this message appears:

! Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding `ansinew'.

\documentclass[a4paper,twoside,10pt]{report}


\usepackage[spanish]{babel} %francais, polish, spanish, ...
\usepackage[T1]{fontenc}
\usepackage[ansinew]{inputenc}
\usepackage{xcolor} 
\usepackage{lmodern} 
\usepackage{siunitx} 
\usepackage{cite}
\usepackage{graphicx} 
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{enumerate}
\usepackage{a4wide} 
\usepackage{fancyhdr} 
\usepackage{longtable} 
\begin{document}

\pagestyle{empty} 

\title{INFORME ETAPA I: 
DIAGNÓSTICO DE LA SITUACIÓN ACTUAL}

\author{CONTRATO No. LCC-MPORTO-2016-003}
\maketitle
\begin{abstract}
some text here
\end{abstract}

\tableofcontents 
\cleardoublepage 
\pagestyle{plain} 

%%Chapters%%

%\include{./capitulos/parte 1} 

\clearpage
\addcontentsline{toc}{chapter}{Índice de Figuras}
\listoffigures

\clearpage
\addcontentsline{toc}{chapter}{Índice de Cuadros}
\listoftables

\appendix


\end{document}

Best Answer

As posted your code is in UTF-8 (as the whole website is UTF-8) and so the accented letters in the title are not understood, as LaTeX is expecting ansinew

! Package inputenc Error: Keyboard character used is undefined
(inputenc)                in inputencoding `ansinew'.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.2 ...nc@undefined@ {ansinew}ndice de Figuras}{3}

? 

The error comes from the Í when read back for the table of contents.

deleting the corrupt .toc file then specifing

\usepackage[utf8]{inputenc}

allows the document to run without error

enter image description here