This commit is contained in:
Kovid Goyal 2007-09-06 17:03:07 +00:00
parent e7f96c2ee0
commit 072852e031

View File

@ -1186,6 +1186,8 @@ class BeautifulStoneSoup(Tag, SGMLParser):
"Handle character references as data." "Handle character references as data."
if self.convertEntities in [self.HTML_ENTITIES, if self.convertEntities in [self.HTML_ENTITIES,
self.XML_ENTITIES]: self.XML_ENTITIES]:
if ref.lower().startswith('x'): # Added by Kovid
ref = int(ref[1:], 16)
data = unichr(int(ref)) data = unichr(int(ref))
else: else:
data = '&#%s;' % ref data = '&#%s;' % ref