Provided a working fix for the remaining errors in the test suite

This commit is contained in:
Daniel Neuhäuser 2010-07-11 01:05:27 +02:00
parent 839cc5aaeb
commit 23af2ea875

View File

@ -1425,12 +1425,16 @@ class XMLParser(object):
err.position = value.lineno, value.offset err.position = value.lineno, value.offset
raise err raise err
def _fixtext(self, text): if sys.version_info >= (3, 0):
# convert text string to ascii, if possible def _fixtext(self, text):
try:
return text.encode("ascii")
except UnicodeError:
return text return text
else:
def _fixtext(self, text):
# convert text string to ascii, if possible
try:
return text.encode("ascii")
except UnicodeError:
return text
def _fixname(self, key): def _fixname(self, key):
# expand qname, and convert name string to ascii, if possible # expand qname, and convert name string to ascii, if possible