--- spambayes-1.0.4/spambayes/PyMeldLite.py.orig 2003-02-01 03:32:27.000000000 +0900 +++ spambayes-1.0.4/spambayes/PyMeldLite.py 2006-10-31 20:24:24.000000000 +0900 @@ -567,12 +567,16 @@ # 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() + # 2005-08-30: updated to support iso-2022-jp, by owa. + 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()