UTF8: removing BOM(Byte Order Mark)

18 December 2016

I got the following error while compiling a Latex-File:

compiling MyLatexfile.tex...
tex/virtualbox.tex:1: Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.

So I checked the encoding of the file and saw that it looked like this:

file tex/virtualbox.tex 
tex/virtualbox.tex: LaTeX document, UTF-8 Unicode (with BOM) text, with very long lines

It seems that inputenc does not like utf-8 with Byte Order Mark. So I removed it using the following sed-command:

sed -i '1 s/^\xef\xbb\xbf//' virtualbox.tex
[ Tricks  sed  Shell  ]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti