Skip to content

How to Fix LaTeX Font Encoding Errors — Special Characters Not Displaying

DodaTech Updated 2026-06-24 2 min read

In this tutorial, you'll learn about How to Fix LaTeX Font Encoding Errors. We cover key concepts, practical examples, and best practices.

The Problem

Your LaTeX document produces output like:

Ol\`{a} mundo!

Or accented characters appear as strange symbols:

! Package inputenc Error: Unicode character ó (U+00F3)
not set up for use with LaTeX.

Font encoding errors happen when you use UTF-8 characters but LaTeX is set up for the default OT1 encoding, which only supports 7-bit ASCII.

Quick Fix

Step 1: Add the correct encoding packages

WRONG — no encoding setup:

\documentclass{article}
\begin{document}
Café résumé naïve
\end{document}

RIGHT — add inputenc and fontenc:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\begin{document}
Café résumé naïve
\end{document}

Output: Café résumé naïve

Step 2: Use the correct font encoding for your language

For most European languages:

\usepackage[T1]{fontenc}

For Cyrillic:

\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}

Step 3: Switch to a modern engine for full Unicode

\documentclass{article}
\usepackage{fontspec}
\setmainfont{TeX Gyre Termes}
\begin{document}
Café résumé naïve 日本語
\end{document}

Compile with xelatex main.tex.

Step 4: Fix hyphenation issues

T1 encoding enables proper hyphenation for accented words:

\usepackage[T1]{fontenc}

Prevention

  • Always add \usepackage[utf8]{inputenc} and \usepackage[T1]{fontenc}.
  • Use xelatex or lualatex for documents with multiple languages or Unicode symbols.
  • Save .tex files as UTF-8 in your editor.

Common Mistakes with font encoding

  1. Forgetting that lazy evaluation defers computation until the value is forced, causing space leaks with unevaluated thunks
  2. Using return to exit a function early instead of wrapping a pure value in the monad
  3. Mixing let bindings with <- bindings in do notation, producing type errors

These mistakes appear frequently in real-world LATEX code. DodaTech's contributors have identified these patterns through analysis of open-source projects and production systems.

Practice Exercise

Write a pure function that safely divides two integers using Maybe, then test it with edge cases like division by zero and negative numbers.

This exercise reinforces the concepts covered in this guide. Try implementing it before checking online solutions.

FAQ

### What is the difference between inputenc and fontenc?

inputenc tells LaTeX how to interpret the bytes in your input file. fontenc tells LaTeX which font encoding to use for output.

Why use T1 instead of the default OT1?

OT1 only supports 128 characters. T1 supports 256 characters with all accented Latin letters and proper hyphenation.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro