Example #1
0
    def test_xml(self):
        assert 'UTF-8' == get_encoding(
            b'<?xml version="1.0" encoding="UTF-8"?>')

        assert not get_encoding(b'<?xm version="1.0" encoding="UTF-8"?>')

        assert not get_encoding(b'<?xml version="1.0" encoding=""?>')
Example #2
0
    def test_html(self):
        assert 'UTF-8' == get_encoding(b'''<meta http-equiv="Content-type"
            content="text/html;charset=UTF-8">''')

        assert not get_encoding(b'''<meta con="text/html;charset=UTF-8">''')

        assert not get_encoding(b'''<meta content="text/html;char=UTF-8">''')
Example #3
0
    def test_xml(self):
        assert 'UTF-8' == get_encoding(
                b'<?xml version="1.0" encoding="UTF-8"?>')

        assert not get_encoding(
                b'<?xm version="1.0" encoding="UTF-8"?>')

        assert not get_encoding(
                b'<?xml version="1.0" encoding=""?>')
Example #4
0
    def test_html(self):
        assert 'UTF-8' == get_encoding(
            b'''<meta http-equiv="Content-type"
            content="text/html;charset=UTF-8">''')

        assert not get_encoding(
            b'''<meta con="text/html;charset=UTF-8">''')

        assert not get_encoding(
            b'''<meta content="text/html;char=UTF-8">''')
Example #5
0
 def test_html5(self):
     assert 'UTF-8' == get_encoding(b'<meta charset="UTF-8">')
     assert 'UTF-8' == get_encoding(b"<meta charset='UTF-8'>")
     assert not  get_encoding(b"<meta charset='UTF-8>")
Example #6
0
 def test_html5(self):
     assert 'UTF-8' == get_encoding(b'<meta charset="UTF-8">')
     assert 'UTF-8' == get_encoding(b"<meta charset='UTF-8'>")
     assert not get_encoding(b"<meta charset='UTF-8>")