def replace_special_chars(html_str: str):
    """
    replace special characters with html entities
    """
    # special chars
    html_str = html_str.replace('&', '&amp;')
    html_str = html_str.replace('<', '&lt;')
    html_str = html_str.replace('>', '&gt;')
    html_str = html_str.replace('"', '&quot;')
    html_str = html_str.replace("'", '&#39;')
    return html_str