[Tex/LaTex] Package inputenc Error: Unicode character ² (U+B2)(inputenc) not set up for use with LaTeX. \acro{I2C}[I²C]

compilation errorerrorstexdocunicode

Package inputenc Error: Unicode character ² (U+B2)(inputenc) not set up for use with LaTeX. \acro{I2C}[I²C]{Inter-Integrated Circuit}

So I get this error I get when I try to compile my university latex template. Any suggestions please?

The code looks something like this:

\documentclass[
a4paper, 
12pt,
oneside,
BCOR1cm,
toc=chapterentrywithdots] 
{scrbook}

\usepackage{graphicx}           % use for pdfLatex
\usepackage{makeidx} % f\"{u}r Benutzung des Befehls \printindex
\usepackage[colorlinks=false]{hyperref}
\usepackage{tocbibind}
\usepackage{blindtext}
\usepackage{subfigure} 
\usepackage{acronym}

\hypersetup{%
bookmarksnumbered=true, hyperindex=true,
%
%Im Acrobat Reader Subtitel 1. Ebene anzeigen
bookmarksopen=true, bookmarksopenlevel=1,
%
pdfborder=0 0 0 % Keine Box um die Links!
}


\renewcommand*{\tableofcontents}{%
    \begingroup
    \tocsection
    \tocfile{\contentsname}{toc}
    \endgroup
}
\renewcommand*{\listoffigures}{%
    \begingroup
    \tocsection
    \tocfile{\listfigurename}{lof}
    \endgroup
}
\renewcommand{\listoftables}{
    \begingroup
    \tocsection
    \tocfile{\listtablename}{lot}
    \endgroup
}
\begin{document}


\begin{titlepage}

{
    \begin{center}
        \raisebox{-1ex}{\includegraphics[scale=1.5] 
{Uni_positiv_gruen.pdf}}\\
    \end{center}
    \vspace{0.5cm}
}

\begin{center}

\LARGE{\textbf{Title of the thesis}}\\
\vspace{1cm}


\Large{\textbf{Thesis}}\\ 
\vspace{1cm}
Submitted in Fulfilment of the\\
Requirements for the Academic Degree\\
M.Sc.\\
\vspace{0.5cm}
Dept. of Computer Science\\
Chair of Computer Engineering
\end{center}
\vspace{3cm}
Submitted by: Max Mustermann\\
Student ID: 111222\\
Date: 12.12.1212\\
\vspace{0.3cm}\\
Supervising tutor: Prof. Dr. \\
(further supervisors)

\end{titlepage}

\addchap*{Abstract}
\blindtext
\\\\
\textbf{Keywords: Keyword1, Keyword2, Keyword3, ...max 5}

\tableofcontents
\listoffigures
\listoftables

\twocolumn
\addchap{List of Abbreviations}
\begin{acronym}[Bash]
\acro{KDE}{K Desktop Environment}
 \acro{SQL}{Structured Query Language}
 \acro{Bash}{Bourne-again shell}
 \acro{JDK}{Java Development Kit}
 \acro{VM}{Virtuelle Maschine}
 \acro{I2C}[I²C]{Inter-Integrated Circuit}
 \acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\acro{JDK}{Java Development Kit}
\acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
 \acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
 \acro{JDK}{Java Development Kit}
 \acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\acro{JDK}{Java Development Kit}
\acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\acro{KDE}{K Desktop Environment}
\acro{SQL}{Structured Query Language}
\acro{Bash}{Bourne-again shell}
\acro{JDK}{Java Development Kit}
\acro{VM}{Virtuelle Maschine}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\acro{I2C}[I²C]{Inter-Integrated Circuit}
\end{acronym}

\chapter{Introduction}
\input{src/intro}  % Load Data from File intro.tex

\chapter{Tables}
\input{src/example_tables} % Load Data from File example_tables

\chapter{Figures}
\input{src/example_figures} % Load Data from File example_figures

\chapter{Referencing}
% Alternativ just write your text under \chapter like this example



\chapter{Subchapter}

\printindex 

\end{document}

Thanks in advance.

Best Answer

As you don't provide the expected MWE, I don't know what \acro does.

But generally speaking, to declare unknown Unicode characters you should load:

\usepackage[utf8]{inputenc}

and use:

\DeclareUnicodeCharacter{<unicode-in-hexa>}{<latex-code>}

that is to say in your case:

\DeclareUnicodeCharacter{00B2}{\ensuremath{{}^2}}

A simpler alternative :

\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newunicodechar{²}{\ensuremath{{}^2}}

EDIT (with the MWE)

I have just pasted:

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{00B2}{\ensuremath{{}^2}}

or

\usepackage[utf8]{inputenc}
\usepackage{newunicodechar}
\newunicodechar{²}{\ensuremath{{}^2}}

at the beginning of the preamble of your MWE, and (after correction of BCOR1cm into BCOR=1cm) it works without any error or warning, and gives in both cases:

output