We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d2d0aba commit 1a80e5eCopy full SHA for 1a80e5e
1 file changed
tests/test_encoding.py
@@ -0,0 +1,32 @@
1
+from fastfeedparser import parse
2
+
3
4
+def test_parse_str_with_non_utf8_xml_declaration():
5
+ xml = (
6
+ '<?xml version="1.0" encoding="iso-8859-1"?>'
7
+ '<rss version="2.0">'
8
+ "<channel>"
9
+ "<title>café</title>"
10
+ "<item><title>café</title></item>"
11
+ "</channel>"
12
+ "</rss>"
13
+ )
14
+ feed = parse(xml)
15
+ assert feed.feed.title == "café"
16
+ assert feed.entries[0].title == "café"
17
18
19
+def test_parse_bytes_with_non_utf8_encoding():
20
+ xml_bytes = (
21
+ b'<?xml version="1.0" encoding="iso-8859-1"?>'
22
+ b'<rss version="2.0">'
23
+ b"<channel>"
24
+ b"<title>caf\xe9</title>"
25
+ b"<item><title>caf\xe9</title></item>"
26
+ b"</channel>"
27
+ b"</rss>"
28
29
+ feed = parse(xml_bytes)
30
31
32
0 commit comments