[Tex/LaTex] ny reason to use inputenc

input-encodings

My LaTeX text editor is GNU Emacs 25.1.1, which encodes text files in UTF-8. Is there any reason to specify

\usepackage[utf8]{inputenc}

in the preamble? Even if I migrate to a different computer with a different TeX installation, is there any risk that the migrated LaTeX files will be misinterpreted if I leave out this line?

Best Answer

Update as of April 2018:

The community has changed its default encoding to UTF-8 as of April 2018 (see https://tug.org/TUGboat/tb39-1/tb121ltnews28.pdf). So, the remark regarding LuaTeX or XeTeX applies to all compilers by now:

\usepackage[utf8]{inputenc} can be omitted, since it does basically nothing

Original answer:

The basic LaTeX/TeX engine expects (or perhaps is meant to process) pure ASCII input. Whenever your file uses any other characters, the inputenc package comes to the rescue, specifying to the engine how to process the symbols you're typing.

So it's quite necessary, whenever you use unicode (non ASCII) characters, to use the inputenc package, in order to have a meaningful output (or sometimes to make a successful run of (La)TeX)

The difference comes with the "naturally UTF8 compliant" engines, such as LuaTeX and XeTeX, which automatically interpret the input files as UTF8 and won't accept different input encodings: in that cases \usepackage[utf8]{inputenc} can be omitted, since it does basically nothing (and is not used internally anyway)

To put it in other terms, the programs do not check whether the file characters comply to the ASCII standards, they simply interpret them to be as such.