[Tutor] Standardizing on Unicode and utf8

Dinesh B Vadhia dineshbvadhia at hotmail.com
Fri Feb 20 11:52:27 CET 2009


We want to standardize on unicode and utf8 and would like to clarify and verify their use to minimize encode()/decode()'ing:

1.  Python source files 
Use the header: # -*- coding: utf8 -*-

2.  Reading files
In most cases, we don't know the source encoding of the files being read.  Do we have to decode('utf8') after reading from file?

3. Writing files
We will always write to files in utf8.  Do we have to encode('utf8') before writing to file?

Is there anything else that we have to consider?

Cheers

Dinesh

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090220/1bdc1a23/attachment.htm>


More information about the Tutor mailing list