summaryrefslogtreecommitdiff
path: root/bs4/tests
diff options
context:
space:
mode:
Diffstat (limited to 'bs4/tests')
-rw-r--r--bs4/tests/test_soup.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/bs4/tests/test_soup.py b/bs4/tests/test_soup.py
index 94f325e..bb97e52 100644
--- a/bs4/tests/test_soup.py
+++ b/bs4/tests/test_soup.py
@@ -278,6 +278,14 @@ class TestUnicodeDammit(unittest.TestCase):
finally:
bs4.dammit.chardet = chardet
+ def test_sniffed_xml_encoding(self):
+ # A document written in UTF-16LE will be converted by a different
+ # code path that sniffs the byte order markers.
+ data = b'\xff\xfe<\x00a\x00>\x00\xe1\x00\xe9\x00<\x00/\x00a\x00>\x00'
+ dammit = UnicodeDammit(data)
+ self.assertEqual(u"<a>áé</a>", dammit.unicode_markup)
+ self.assertEqual("utf-16le", dammit.original_encoding)
+
class TestNamedspacedAttribute(SoupTest):