# CODING:GBK
Import sys
import locale
def p (f):
print '%s.%s ():%s '% (f.__module__, f.__name__, F ())
# returns the default character encoding
P (sys.getdefaultencoding) # used by the current system
returns the encoding p used to convert the Unicode file name to the system file name
( sys.getfilesystemencoding)
# Gets the default locale and returns the Ganso (language, encoding)
P (locale.getdefaultlocale)
# Returns the user-defined text data encoding
# documentation refers to this function only returns a Guess
p (locale.getpreferredencoding)
# \xba\xba is a ' Han ' GBK code
# MBCS is an deprecated encoding, where only testing shows why
print R "' \xba\xba '. Decode (' MBCS ') should not be used:", repr (' \xba\xba '. Decode (' MBCS '))
# Results on the author's windows (Locale to Chinese (Simplified, Chinese))
#sys. getdefaultencoding (): GBK
#sys. getfilesystemencoding (): MBCS
#locale. Getdefaultlocale (): (' zh_cn ', ' cp936 ')
#locale. getpreferredencoding (): cp936
# ' \xba\xba '. Decode (' MBCS '): U ' \u6c49 '