MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / getpreferredencoding

Function getpreferredencoding

tools/python-3.11.9-amd64/Lib/locale.py:667–676  ·  view source on GitHub ↗

Return the charset that the user is likely using.

(do_setlocale=True)

Source from the content-addressed store, hash-verified

665 CODESET
666except NameError:
667 def getpreferredencoding(do_setlocale=True):
668 """Return the charset that the user is likely using."""
669 if sys.flags.warn_default_encoding:
670 import warnings
671 warnings.warn(
672 "UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.",
673 EncodingWarning, 2)
674 if sys.flags.utf8_mode:
675 return 'utf-8'
676 return getencoding()
677else:
678 # On Unix, if CODESET is available, use that.
679 def getpreferredencoding(do_setlocale=True):

Callers

nothing calls this directly

Calls 3

getencodingFunction · 0.85
setlocaleFunction · 0.85
warnMethod · 0.45

Tested by

no test coverage detected