We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parentb39e8a0 commit2619bdaCopy full SHA for 2619bda
src/html5lib/tokenizer.py
@@ -128,17 +128,11 @@ def consumeNumberEntity(self, isHex):
128
"illegal-codepoint-for-numeric-entity",
129
"datavars": {"charAsInt":charAsInt}})
130
try:
131
-# XXX We should have a separate function that does "int" to
132
-# "unicodestring" conversion since this doesn't always work
133
-# according to hsivonen. Also, unichr has a limitation of 65535
+# Try/except needed as UCS-2 Python builds' unichar only works
+# within the BMP.
134
char=unichr(charAsInt)
135
-except:
136
-try:
137
-char=eval("u'\\U%08x'"%charAsInt)
138
139
-self.tokenQueue.append({"type":tokenTypes["ParseError"],"data":
140
-"cant-convert-numeric-entity",
141
-"datavars": {"charAsInt":charAsInt}})
+exceptValueError:
+char=eval("u'\\U%08x'"%charAsInt)
142
143
# Discard the ; if present. Otherwise, put it back on the queue and
144
# invoke parseError on parser.