Name
setdefaultencoding
Synopsis
setdefaultencoding(name
)
Sets the default codec used to encode and decode Unicode and string
objects (normally 'ascii
').
setdefaultencoding
is meant to be called only from
sitecustomize.py
during startup; the
site
module removes this attribute from
sys
. You can call reload(sys)
to make this attribute available again, but this is not considered
good programming practice. Unicode, codecs, encoding, and decoding
are covered in Chapter 9. The
site
and sitecustomize
modules
are covered in Chapter 13.
Get Python in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.