def encode_html_for_file(html):
    """Hack in a meta tag at the top of an HTML snippet to make the resulting
    file display correctly in a web browser."""
    return ('<meta charset="utf-8">\n' + html).encode('utf-8')