TemplateHelper: don't break numeric character references when fixing a template
TemplateHelper: fixed bad encoding on PHP 5.3