FYI. I had just receive something from a friend, he give me following
nice example!

I have one more question on this: How to write if I want to specify
locale other than current locale? For example, program runn on Korea
locale system, and try reading a UTF-8 file that save chinese
characters.

-------------- The code is here --------------------
import codecs
def read_utf8_txt_file (filename):
    fileObj = codecs.open( filename, "r", "utf-8" )
    content = fileObj.read()
    content = content[1:] #exclude BOM
    print content
    fileObj.close()

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to