Fixed Umlaut problem. Added encoding detection for reading in templates ...

...and latex generated HTML. Fixed also broken code to write correct UTF-8 html files.