[I18n-sig] Big5 Codecs
Frank J.S. Chen
frank63@ms5.hinet.net
Sun, 5 Nov 2000 18:23:22 -0000
>
> 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).
Yes, it is 1.6. I cannot use Python 2.0 in Slackware right now for a make
error.
>
> 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.
>
Certainly it is. I always prefer standard interface.
----------------------------------------------------------------------------
-------
Chen Chien-Hsun
Taipei,Taiwan,R.O.C.