def standard_codec_name(name: str) -> str:
    """
    Map a codec name to the preferred standardized version.

    The preferred names were taken from this list published by IANA:
    U{http://www.iana.org/assignments/character-sets/character-sets.xhtml}

    @param name:
        Text encoding name, in lower case.
    """
    if name.startswith("iso8859"):
        return "iso-8859" + name[7:]
    return {
        "ascii": "us-ascii",
        "euc_jp": "euc-jp",
        "euc_kr": "euc-kr",
        "iso2022_jp": "iso-2022-jp",
        "iso2022_jp_2": "iso-2022-jp-2",
        "iso2022_kr": "iso-2022-kr",
    }.get(name, name)