[I18n-sig] Big5 Codecs

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Sat, 4 Nov 2000 22:32:29 +0100


> I have made the Big5 Codecs, and it is workable.

Very interesting work. In the test directory, you ship a big5_tw.pyc,
which happens not to be accepted by Python 2 (I assume it is a 1.6
bytecode file).

I'd recommend to change the test to properly use the installed
software, i.e. 

twstring = "這是一個測試, 英文是\"This is a test.\"\n" + \
           "先把BIG5碼轉換成Unicode, 再把Unicode轉\n" + \
           "回BIG5碼. 效果還不錯, 但效能差一點."

uni = unicode(twstring, "big5_tw")
bstring = uni.encode("big5_tw")

print "Original BIG5 encoded string:"
print twstring
print "Transcode to Unicode encoding:"
print repr(uni)
print "Back to BIG5 encoding:"
print bstring

then you won't need big5_tw in the current directory anymore.

If you want the test to use the codec object, codec.lookup is probably
better.

Regards,
Martin