File tree 1 file changed +4
-10
lines changed
1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -128,17 +128,11 @@ def consumeNumberEntity(self, isHex):
128
128
"illegal-codepoint-for-numeric-entity" ,
129
129
"datavars" : {"charAsInt" : charAsInt }})
130
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
131
+ # Try/except needed as UCS-2 Python builds' unichar only works
132
+ # within the BMP.
134
133
char = unichr (charAsInt )
135
- except :
136
- try :
137
- char = eval ("u'\\ U%08x'" % charAsInt )
138
- except :
139
- self .tokenQueue .append ({"type" : tokenTypes ["ParseError" ], "data" :
140
- "cant-convert-numeric-entity" ,
141
- "datavars" : {"charAsInt" : charAsInt }})
134
+ except ValueError :
135
+ char = eval ("u'\\ U%08x'" % charAsInt )
142
136
143
137
# Discard the ; if present. Otherwise, put it back on the queue and
144
138
# invoke parseError on parser.
You can’t perform that action at this time.
0 commit comments