/[opental]/opental/pax/utils.py
ViewVC logotype

Diff of /opental/pax/utils.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.12 by lalo, Mon Apr 14 22:13:02 2003 UTC revision 1.13 by lalo, Tue Aug 26 21:50:24 2003 UTC
# Line 4  Line 4 
4    
5  from backwards_compatibility import *  from backwards_compatibility import *
6  from xml.sax.saxutils import escape  from xml.sax.saxutils import escape
7  import sys, types  import sys, types, unicodedata
8    
9  _replace='replace'  _replace='replace'
10    
# Line 62  try: Line 62  try:
62      psyco.bind(pack_list)      psyco.bind(pack_list)
63  except:  except:
64      pass      pass
65    
66    def unicode2ascii(unistr):
67        l = []
68        for c in unistr:
69            d = unicodedata.decomposition(c)
70            if d:
71                for e in d.split():
72                    e = int(e, 16)
73                    if 65 <= e <= 122:
74                        l.append(chr(e))
75            else:
76                if ord(c) < 128:
77                    l.append(str(c))
78        return ''.join(l)

Legend:
Removed from v.1.12  
changed lines
  Added in v.1.13

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26