[Tex/LaTex] Encoding problem with accents and inputenc package

accentsinputinput-encodingspackagespdftex

I have this problem, it seems I'm doing something wrong while writing letters with accents like è, on that line the compiler says: package inputenc Error: unicode char \u8:èun not set up for use. This happens when I use my LaTeX editor, compiling the same code with an R sweave file on Rstudio it works normally and I got my accents on letters.

The code used is:

\documentclass[12pt,a4paper,oneside,openright]{book} %oneside versione segreteria
\usepackage[a4paper,top=2cm,bottom=2cm,left=3cm,right=2.5cm]{geometry}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,italian]{babel}
\usepackage{bm}
\usepackage{amsmath}
\usepackage{mathrsfs}
%\uspackage{graphicx}
\usepackage{hyperref}

\begin{document}

%________________________________________________________________

\frontmatter

%space for abstract

\pagestyle{plain}
\tableofcontents

%_______________________________________________


\mainmatter

\pagestyle{plain} 

%Primo Capitolo
%\addcontentsline{toc}{chapter}{Introduzione}

\chapter*{Introduzione}

L'accrescimento è  


\end{document}

Best Answer

Very likely your file ended up not being saved as UTF-8.

If you didn't change the default settings in the preferences, TeXShop saves files as Latin-1 (older versions use MacRoman).

Remember to add

% !TEX encoding = UTF-8 Unicode

at the start of your files. Do it and save the file; close and reopen it, then try running LaTeX on it.

In any case, it's better if you also go to the preferences and change the default encoding to UTF-8.

Related Question