Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

No matter how I try to do it I always get the following error :

! Package inputenc Error: Unicode char \u8:­ not set up for use with LaTeX.

I have tried using ­­­$^{\circ}$, \deg, \textdegree, pasting the ° symbol directly, to no avail.

Here is the header of my document, in case one of those could be causing the errors :

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[francais]{babel}
%\FrenchItemizeSpacingfalse
\frenchbsetup{CompactItemize=false}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amsthm}
share|improve this question
    
I had the same issue. In my case it was an issue due to a misleading character in my bibdesk library. After exchange and a new run with BibTex everything was fine again. –  user12684 Mar 16 '12 at 12:10
    
A quick solution is to use the "Zap Gremlins" feature in the fantastic (and free to use) TextWrangler. This removes non-ASCII, control and NULL characters. IF you want a simple ASCII input file this will save you lots of time looking for invisible characters. –  boyfarrell Jul 1 at 10:55

4 Answers 4

up vote 46 down vote accepted

If you're getting literally that error—with no visible character after the \u8:—then what's probably happening is that you have some sort of invisible or space unicode character in your document. For instance, on my Mac, if I hit option-space, I get a non-breaking space, which gives an error that looks like that. You also might have some other character; a zero-width breakable space, for instance. If you copied and pasted your error, looking at the source of this page indicates that you might have a soft hyphen in your source (Unicode character 0xAD, representing a valid hyphenation point but not typeset unless there's a word-break). Thus, find the line it's occurring on, and comb through that line until you find it. Retype it if necessary, but a good editor should let you find it. Once you delete it, then your first three methods should work.

When I use your header (commenting out \frechbsetup, which doesn't seem to exist, and using \documentclass{article}), $^{\circ}$ renders as a largeish circle in the superscript position, $\deg$ renders as the upright text "deg", and \textdegree renders as a smaller circle. A literal ° doesn't work by default. To make it work, you can use \DeclareUnicodeCharacter{B0}{\textdegree}. This tells inputenc to treat the Unicode character 0xB0, the °, as though it were \textdegree, which is what you want. You could also use this to see if your problem is the soft hyphen; insert \DeclareUnicodeCharacter{AD}{\Huge [ICI]} to get the text [ICI] rendered into your document in huge letters wherever there's a soft hyphen. (Of course, if there's some other invisible character, you'll just get the error.)

Also, although I've never used it, you could try using XeLaTeX instead of PDFLaTeX; it has full UTF-8 support out of the box.

share|improve this answer
2  
Indeed, an invisible character seemed to be the source of my problem. Thanks! –  levesque Oct 18 '10 at 17:14
2  
No problem. I remember how befuddled I was the first time I ran into this problem; I'm glad I could help someone else out with it. –  Antal S-Z Oct 18 '10 at 17:35
    
@AntalS-Z Is there a way to detect which symbol is causing this error ? It is giving this error in the first line where there is plain text. Thanks. –  Anusha Oct 15 at 9:40
    
@Anusha: Not that I can think of off the top of my head – depending on your editor, you could (a) retype the line, (b) step through it with the arrow keys until you hit something strange, (c) turn on some sort of "show invisible characters" setting, or (d) put the file through some sort of shell filter like cat -v or xxd to see where the first wrong character is. –  Antal S-Z Oct 16 at 20:09
    
Showing invisible characters doesnt help in Notepad++. Any tips using emacs ? Or which editor might help with it ? –  Anusha Oct 16 at 20:15

Using

\usepackage[utf8x]{inputenc} 

instead of [utf8] solved the problem for me. Hope this helps,

Vojta

share|improve this answer

\usepackage{textcomp} is missing.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\begin{document}
 °
\end{document}
share|improve this answer

I got this error after copying a word from my browser and pasting it into my editor. Just retyped it an the problem was solved.

share|improve this answer

protected by Martin Scharrer Jan 18 '13 at 15:34

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.