linkchecker/linkcheck/checker
Chris Mayo c89c617a58 Ignore an encoding of ISO-8859-1 returned by Requests
ISO-8859-1 is a fallback for Requests and causes us to mangle UTF-8
content.

Requests' utils.py:

def get_encoding_from_headers(headers):
    """Returns encodings from given HTTP Header Dict.

    :param headers: dictionary to extract encoding from.
    :rtype: str
    """

    content_type = headers.get('content-type')

    if not content_type:
        return None

    content_type, params = _parse_content_type_header(content_type)

    if 'charset' in params:
        return params['charset'].strip("'\"")

    if 'text' in content_type:
        return 'ISO-8859-1'

    if 'application/json' in content_type:
        # Assume UTF-8 based on RFC 4627: https://www.ietf.org/rfc/rfc4627.txt since the charset was unset
        return 'utf-8'
2021-11-29 19:52:37 +00:00
..
__init__.py Make partial and example URLs in docstrings italic 2021-08-12 19:28:50 +01:00
const.py Fix critical exception when parsing a URL with a ] 2020-08-08 16:47:31 +01:00
dnsurl.py Fix formatting and typos in docstrings 2020-07-25 16:35:48 +01:00
fileurl.py Make partial and example URLs in docstrings italic 2021-08-12 19:28:50 +01:00
ftpurl.py Remove unneeded pass statements 2020-08-22 17:17:02 +01:00
httpurl.py Ignore an encoding of ISO-8859-1 returned by Requests 2021-11-29 19:52:37 +00:00
ignoreurl.py Run black on linkcheck/ 2020-05-30 17:01:36 +01:00
internpaturl.py Remove strformat.unicode_safe() and strformat.url_unicode_split() 2020-07-07 17:25:28 +01:00
itmsservicesurl.py Remove unneeded pass statements 2020-08-22 17:17:02 +01:00
mailtourl.py Fix deprecation warning for resolver.query() 2020-09-14 19:55:05 +01:00
nntpurl.py Run black on linkcheck/ 2020-05-30 17:01:36 +01:00
proxysupport.py Make partial and example URLs in docstrings italic 2021-08-12 19:28:50 +01:00
telneturl.py Convert to Python 3 super() 2020-06-03 20:06:36 +01:00
unknownurl.py Add slack to the list of ignored schemes 2020-08-09 17:10:26 +01:00
urlbase.py Make partial and example URLs in docstrings italic 2021-08-12 19:28:50 +01:00