aee018f39c813bb3ff12f67f19022d5c584f629b,vendor/readability/encoding.py,,get_encoding,#Any#,4

Before Change


def get_encoding(page):
    // Regex for XML and HTML Meta charset declaration
    charset_re = re.compile(r"<meta.*?charset=["\"]*(.+?)["\">]", flags=re.I)
    pragma_re = re.compile(r"<meta.*?content=["\"]*;?charset=(.+?)["\">]", flags=re.I)
    xml_re = re.compile(r"^<\?xml.*?encoding=["\"]*(.+?)["\">]")

    declared_encodings = (charset_re.findall(page) +
            pragma_re.findall(page) +

After Change


            // Now let"s decode the page
            page.decode()
            // It worked!
            return encoding
        except UnicodeDecodeError:
            pass

    // Fallback to chardet if declared encodings fail
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: samuelclay/NewsBlur
Commit Name: aee018f39c813bb3ff12f67f19022d5c584f629b
Time: 2017-01-25
Author: samuel@ofbrooklyn.com
File Name: vendor/readability/encoding.py
Class Name:
Method Name: get_encoding


Project Name: RasaHQ/rasa
Commit Name: db36f20b88709421b9a59c31d2092385e565fb2e
Time: 2020-11-19
Author: federicotedin@gmail.com
File Name: rasa/nlu/utils/__init__.py
Class Name:
Method Name: is_url


Project Name: matplotlib/matplotlib
Commit Name: 0b92b4f5530fee68432f13075a1ddc866748f9d1
Time: 2020-11-20
Author: anntzer.lee@gmail.com
File Name: examples/showcase/firefox.py
Class Name:
Method Name: svg_parse