[Python-checkins] CVS: python/dist/src/Mac/Lib aepack.py,1.2,1.2.14.1
Jack Jansen
jackjansen@users.sourceforge.net
Sun, 24 Feb 2002 14:47:45 -0800
Update of /cvsroot/python/python/dist/src/Mac/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv17797
Modified Files:
Tag: release22-maint
aepack.py
Log Message:
Backport of 1.3:
Added support for unicode strings (utxt).
Index: aepack.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Lib/aepack.py,v
retrieving revision 1.2
retrieving revision 1.2.14.1
diff -C2 -d -r1.2 -r1.2.14.1
*** aepack.py 25 Aug 2001 12:00:49 -0000 1.2
--- aepack.py 24 Feb 2002 22:47:43 -0000 1.2.14.1
***************
*** 89,92 ****
--- 89,97 ----
if t == StringType:
return AE.AECreateDesc('TEXT', x)
+ if t == UnicodeType:
+ data = t.encode('utf16')
+ if data[:2] == '\xfe\xff':
+ data = data[2:]
+ return AE.AECreateDesc('utxt', data)
if t == ListType:
list = AE.AECreateList('', 0)
***************
*** 133,136 ****
--- 138,143 ----
if t == typeChar:
return desc.data
+ if t == typeUnicodeText:
+ return unicode(desc.data, 'utf16')
# typeColorTable coerced to typeAEList
# typeComp coerced to extended