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.

I have written some LaTeX commands in a separate file, say foo.tex and include them in my LaTeX document.

Only after I edit foo.tex with Notepad (default editor in Windows), I get the following error message when compiling :

Unicode char \u8: not set up for use with LaTeX

I suspect that Notepad alters my text file, which is saved as previously with the UTF-8 encoding. How can I prevent it ?

share|improve this question
3  
The answer is that foo.tex is not UTF-8 encoded. –  egreg Jan 14 at 20:53
    
Windows system's encoding is ISO isn't it? –  Sigur Jan 14 at 20:57
1  
According to Notepad, both files are in "UTF-8" encoding. However, I suspect that various encodings may be called "UTF-8" by Notepad. –  Laurent Jan 14 at 20:59
    
On GNU/Linux, you can try file --mine foo.tex to get the 'charset', but it is not foolproof.... –  jon Jan 14 at 21:00
1  
You might try moving to Notepad2 or notepad++; both load about as fast as notepad and won't screw up your EOL markers. –  Canageek Jan 14 at 21:20

1 Answer 1

up vote 9 down vote accepted

Very likely notepad puts a byte order marker (BOM) at the start of the file. The "character" is invisible, but present. See also: How to make notepad to save text in utf-8 without bom?

For TeX files that are input after package inputenc is loaded, BOM can be disabled by:

\usepackage[utf8]{inputenc}
\DeclareUnicodeCharacter{FEFF}{}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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