[Pythonmac-SIG] ANN: TECManager 0.1 - Converts Mac encoded text to Unicode

Bob Ippolito bob at redivi.com
Sat Sep 6 03:41:33 EDT 2003


While working on the latest revision of aeve, I realized that all of  
the AEText stuff is a pain in the ass.  I don't want to know that text  
is encoded in smRoman or smGreek, I just want text that works.  So, I  
did some research and figured out that The Way to make sense of  
script/language/region-ized text is to use part of Text Encoding  
Conversion Manager/UnicodeServices (  
http://developer.apple.com/documentation/Carbon/Reference/ 
Text_Encodin_sion_Manager/ ).

TECManager is an *extremely* simple package.  It has one function and a  
bunch of constants.  It's much smarter and more complete than the mac  
encoding packages that come with Python.

Example usage:

 >>> import TECManager as TM
 >>> TM.ConvertToUnicode('\xa5', script=TM.smRoman) # convert a macRoman  
bullet to a unicode bullet
u'\u2022'
 >>> TM.ConvertToUnicode('\xde', script=TM.smHebrew) # convert a  
smHebrew HEBREW POINT QAMATS, alternate form "qamats qatan"
u'\u05b8\uf87f'

Of course, it works with more than one character at a time.

homepage:
	http://undefined.org/python/

pydoc documentation:
	http://undefined.org/python/TECManager-0.1-pydoc.html

source tarball:
	http://undefined.org/python/TECManager-0.1.tar.gz

PackageManager URL (Python 2.3 - 10.2.x):
	http://undefined.org/python/pimp/darwin-6.6-Power_Macintosh.plist

-bob




More information about the Pythonmac-SIG mailing list