mirror of
https://github.com/python/cpython.git
synced 2025-09-14 20:56:06 +00:00
#1651995: fix _convert_ref for non-ASCII characters.
This commit is contained in:
parent
95fafec732
commit
0c7b2c9c19
2 changed files with 10 additions and 1 deletions
|
@ -396,7 +396,7 @@ class SGMLParser(markupbase.ParserBase):
|
||||||
n = int(name)
|
n = int(name)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
return
|
return
|
||||||
if not 0 <= n <= 255:
|
if not 0 <= n <= 127:
|
||||||
return
|
return
|
||||||
return self.convert_codepoint(n)
|
return self.convert_codepoint(n)
|
||||||
|
|
||||||
|
|
|
@ -373,6 +373,15 @@ DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01//EN'
|
||||||
if len(data) != CHUNK:
|
if len(data) != CHUNK:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
def test_only_decode_ascii(self):
|
||||||
|
# SF bug #1651995, make sure non-ascii character references are not decoded
|
||||||
|
s = '<signs exclamation="!" copyright="©" quoteleft="‘">'
|
||||||
|
self.check_events(s, [
|
||||||
|
('starttag', 'signs',
|
||||||
|
[('exclamation', '!'), ('copyright', '©'),
|
||||||
|
('quoteleft', '‘')]),
|
||||||
|
])
|
||||||
|
|
||||||
# XXX These tests have been disabled by prefixing their names with
|
# XXX These tests have been disabled by prefixing their names with
|
||||||
# an underscore. The first two exercise outstanding bugs in the
|
# an underscore. The first two exercise outstanding bugs in the
|
||||||
# sgmllib module, and the third exhibits questionable behavior
|
# sgmllib module, and the third exhibits questionable behavior
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue