Correct output encoding set even when the template option is used
Fixed GH#72: all ways to set header IDs now follow the same scheme
Better default HTML template

Added doctype and charset.
Outputting correct HTML charset in HTML template depending on encoding