Error

LaTeX Error: Unicode character not set up

The fix

This error means pdfLaTeX met a character (an accented letter, a dash, a curly quote, or an emoji), that it has no definition for. Fix it by adding \usepackage[utf8]{inputenc} and \usepackage[T1]{fontenc} to the preamble, or switch the compiler to XeLaTeX or LuaLaTeX, which read UTF-8 natively.

Not sure it worked on your document? Paste it into LetX and compile it, free and in the browser.

Why it happens

Classic pdfLaTeX only understands characters that are declared. Text pasted from Word or the web often contains typographic characters (curly quotes, en and em dashes, non-breaking spaces, or letters stored as base plus combining accent), that are not set up, so inputenc stops. XeLaTeX and LuaLaTeX avoid this entirely.

Example

% Fix for pdfLaTeX. Add to the preamble:
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}

% Or compile with XeLaTeX / LuaLaTeX (no inputenc needed).

% One stubborn symbol? Map it:
\DeclareUnicodeCharacter{2603}{\ensuremath{\star}}

Frequently asked questions

Which package do I need for accents like é, ü, ñ?

With pdfLaTeX: \usepackage[utf8]{inputenc} plus \usepackage[T1]{fontenc}. That covers Latin accents. For non-Latin scripts use XeLaTeX or LuaLaTeX with fontspec.

It points at U+0301 or a "combining" character.

Your accent is stored as a letter plus a separate combining mark. Re-type it as a single precomposed character (é, not e followed by a combining accent), or normalize the file to NFC.

How do I switch to XeLaTeX?

In LetX, set the project compiler to XeLaTeX in settings; locally, run xelatex main.tex or latexmk -xelatex. Then Unicode input works without inputenc.

Related LaTeX fixes

Browse all LaTeX problems & fixes, or start with the LaTeX guide.

Learn the topic properly

Try the fix in LetX

Open the editor, paste your code, and compile in seconds to see the error clear. Free, in your browser.

Open LetX Free