--- spambayes-1.0.3/spambayes/PyMeldLite.py.orig 2003-02-01 03:32:27.000000000 +0900 +++ spambayes-1.0.3/spambayes/PyMeldLite.py 2005-02-02 19:55:24.000000000 +0900 @@ -565,14 +565,18 @@ source = source[:match.start(1)] + match.group(2) + \ source[match.end(1):] + # support utf-8 (2005-02-02 by owa) # Map characters not allowed in XML content to sensible things. source = source.translate(badxml_map) - source = re.sub('([\x80-\xff])', replaceHighCharacters, source) - - # Parse the XML and generate the tree. - g = _TreeGenerator() - g.feed(source) - g.close() + try: + g = _TreeGenerator() + g.feed(source) + g.close() + except: # may be xml.parsers.expat.ExpatError in versions 2.3 and above + source = re.sub('([\x80-\xff])', replaceHighCharacters, source) + g = _TreeGenerator() + g.feed(source) + g.close() # Get the tree and put the DOCTYPE back in if we hacked it out above. tree = g.getTree()