#1887. Escape characters which are not allowed to appear in attribute values.

This commit is contained in:
Marshall T. Vandegrift 2009-02-25 00:14:11 -05:00
parent f1ba77d172
commit df4b4707a2

View File

@ -276,8 +276,11 @@ class UnBinary(object):
state = 'get attr' state = 'get attr'
elif count > 0: elif count > 0:
if not in_censorship: if not in_censorship:
self.buf.write(c.encode( if c == '"':
'ascii', 'xmlcharrefreplace')) c = '"'
elif c == '<':
c = '&lt;'
self.buf.write(c.encode('ascii', 'xmlcharrefreplace'))
count -= 1 count -= 1
if count == 0: if count == 0:
if not in_censorship: if not in_censorship: