[Python-checkins] r70906 - in python/trunk/Lib: sgmllib.py test/test_sgmllib.py
georg.brandl
python-checkins at python.org
Wed Apr 1 00:11:54 CEST 2009
Author: georg.brandl
Date: Wed Apr 1 00:11:53 2009
New Revision: 70906
Log:
#1651995: fix _convert_ref for non-ASCII characters.
Modified:
python/trunk/Lib/sgmllib.py
python/trunk/Lib/test/test_sgmllib.py
Modified: python/trunk/Lib/sgmllib.py
==============================================================================
--- python/trunk/Lib/sgmllib.py (original)
+++ python/trunk/Lib/sgmllib.py Wed Apr 1 00:11:53 2009
@@ -396,7 +396,7 @@
n = int(name)
except ValueError:
return
- if not 0 <= n <= 255:
+ if not 0 <= n <= 127:
return
return self.convert_codepoint(n)
Modified: python/trunk/Lib/test/test_sgmllib.py
==============================================================================
--- python/trunk/Lib/test/test_sgmllib.py (original)
+++ python/trunk/Lib/test/test_sgmllib.py Wed Apr 1 00:11:53 2009
@@ -373,6 +373,15 @@
if len(data) != CHUNK:
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
# an underscore. The first two exercise outstanding bugs in the
# sgmllib module, and the third exhibits questionable behavior
More information about the Python-checkins
mailing list