Mercurial > traipse_dev
diff orpg/orpg_xml.py @ 23:551cd440acce traipse_dev
Final Dev build of the Day. Should reduce RAM usage more.
author | sirebral |
---|---|
date | Sat, 25 Jul 2009 21:05:18 -0500 |
parents | 4385a7d0efd1 |
children | c54768cffbd4 |
line wrap: on
line diff
--- a/orpg/orpg_xml.py Sat Jul 25 20:36:12 2009 -0500 +++ b/orpg/orpg_xml.py Sat Jul 25 21:05:18 2009 -0500 @@ -53,10 +53,8 @@ def strip_unicode(txt): for i in xrange(len(txt)): if txt[i] not in string.printable: - try: - txt = txt.replace(txt[i], '&#' + str(ord(txt[i])) + ';') - except: - txt = txt.replace(txt[i], '{?}') + try: txt = txt.replace(txt[i], '&#' + str(ord(txt[i])) + ';') + except: txt = txt.replace(txt[i], '{?}') return txt def strip_text(txt): @@ -65,10 +63,7 @@ bad_txt_found = 0 txt = strip_unicode(txt) for c in txt: - if ord(c) < 128: - u_txt += c - else: - bad_txt_found = 1 - if bad_txt_found: - print "Some non 7-bit ASCII characters found and stripped" + if ord(c) < 128: u_txt += c + else: bad_txt_found = 1 + if bad_txt_found: print "Some non 7-bit ASCII characters found and stripped" return u_txt