Skip to content

Commit a32c604

Browse files
committed
Merge
2 parents 38e27a7 + 9d478a3 commit a32c604

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/html5lib/html5parser.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -731,8 +731,11 @@ def startTagMeta(self, token):
731731
if "charset" in attributes:
732732
self.parser.tokenizer.stream.changeEncoding(attributes["charset"])
733733
elif "content" in attributes:
734-
data = inputstream.EncodingBytes(
735-
attributes["content"].encode(self.parser.tokenizer.stream.charEncoding[0]))
734+
# Encoding it as UTF-8 here is a hack, as really we should pass
735+
# the abstract Unicode string, and just use the
736+
# ContentAttrParser on that, but using UTF-8 allows all chars
737+
# to be encoded and as a ASCII-superset works.
738+
data = inputstream.EncodingBytes(attributes["content"].encode("utf-8"))
736739
parser = inputstream.ContentAttrParser(data)
737740
codec = parser.parse()
738741
self.parser.tokenizer.stream.changeEncoding(codec)

0 commit comments

Comments
 (0)