Login  Register

UTF-8 BOM makes the title and header attributes unrecognized

Posted by programandala.net on Feb 01, 2014; 3:19pm
URL: https://discuss.asciidoctor.org/UTF-8-BOM-makes-the-title-and-header-attributes-unrecognized-tp1341.html

While rendering a big adoc file, every level 0 title caused an error:

        asciidoctor: ERROR: filename.adoc: line X: only book doctypes can
        contain level 0 sections

But ":doctype: book" was in the document header! The only way to make
the doctype effective was as command line parameter: "-a doctype=book".

After a little investigation with several test files and an hex viewer I
finally discovered the problem: the trouble document had an UTF-8 BOM
(Byte Order Mark) at the start: 0xEF, 0xBB and 0xBF. Then I used Vim to
remove the BOM and the errors disappeared.

When the BOM is present, the document is rendered but its title is
mistaken for ordinary content, and its header attributes too.

I guess this issue is an undocumented limitation.

--
Marcos Cruz
http://programandala.net