def get_content_type_encoding(curi):
    content_type = "text/plain"
    charset = ""

    if curi.rep_header and "Content-Type" in curi.rep_header:
        (content_type, charset) = extract_content_type_encoding(
                curi.rep_header["Content-Type"])

    if charset == "" and curi.content_body and len(curi.content_body) >= 512:
        # no charset information in the http header
        first_bytes = curi.content_body[:512].lower()
        ctypestart = first_bytes.find("content-type")
        if ctypestart != -1:
            # there is a html header
            ctypestart = first_bytes.find("content=\"", ctypestart)
            ctypeend = first_bytes.find("\"", ctypestart + 9)
            return extract_content_type_encoding(
                    first_bytes[ctypestart + 9:ctypeend])

    return (content_type, charset)
Determine the content encoding based on the `Content-Type` Header.
dataset/ETHPy150Open retresco/Spyder/src/spyder/encoding.py/get_content_type_encoding