MCPcopy Index your code
hub / github.com/RustPython/RustPython / getpreferredencoding

Function getpreferredencoding

Lib/locale.py:635–644  ·  view source on GitHub ↗

Return the charset that the user is likely using.

(do_setlocale=True)

Source from the content-addressed store, hash-verified

633 CODESET
634except NameError:
635 def getpreferredencoding(do_setlocale=True):
636 """Return the charset that the user is likely using."""
637 if sys.flags.warn_default_encoding:
638 import warnings
639 warnings.warn(
640 "UTF-8 Mode affects locale.getpreferredencoding(). Consider locale.getencoding() instead.",
641 EncodingWarning, 2)
642 if sys.flags.utf8_mode:
643 return 'utf-8'
644 return getencoding()
645else:
646 # On Unix, if CODESET is available, use that.
647 def getpreferredencoding(do_setlocale=True):

Callers

nothing calls this directly

Calls 3

getencodingFunction · 0.70
setlocaleFunction · 0.70
warnMethod · 0.45

Tested by

no test coverage detected