diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2002-02-05 21:24:47 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2002-02-05 21:24:47 (GMT) |
commit | 5bb8f78d978bb795decd9b7ebb84f928a67473ad (patch) | |
tree | 375f5834407643763c4b9edf1de34b94ccec22b9 /Mac/Lib | |
parent | 085eb1b3723b14cdcb69d60099033be22910dbec (diff) | |
download | cpython-5bb8f78d978bb795decd9b7ebb84f928a67473ad.zip cpython-5bb8f78d978bb795decd9b7ebb84f928a67473ad.tar.gz cpython-5bb8f78d978bb795decd9b7ebb84f928a67473ad.tar.bz2 |
Added support for unicode strings (utxt).
Diffstat (limited to 'Mac/Lib')
-rw-r--r-- | Mac/Lib/aepack.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Mac/Lib/aepack.py b/Mac/Lib/aepack.py index 161f3eb..331a53e 100644 --- a/Mac/Lib/aepack.py +++ b/Mac/Lib/aepack.py @@ -88,6 +88,11 @@ def pack(x, forcetype = None): return AE.AECreateDesc('doub', struct.pack('d', x)) 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) for item in x: @@ -132,6 +137,8 @@ def unpack(desc): return struct.unpack('b', desc.data)[0] if t == typeChar: return desc.data + if t == typeUnicodeText: + return unicode(desc.data, 'utf16') # typeColorTable coerced to typeAEList # typeComp coerced to extended # typeData returned as unknown |