MCPcopy
hub / github.com/django/django / get_system_encoding

Function get_system_encoding

django/utils/encoding.py:248–259  ·  view source on GitHub ↗

The encoding for the character type functions. Fallback to 'ascii' if the #encoding is unsupported by Python or could not be determined. See tickets #10335 and #5846.

()

Source from the content-addressed store, hash-verified

246
247
248def get_system_encoding():
249 """
250 The encoding for the character type functions. Fallback to 'ascii' if the
251 #encoding is unsupported by Python or could not be determined. See tickets
252 #10335 and #5846.
253 """
254 try:
255 encoding = locale.getlocale()[1] or "ascii"
256 codecs.lookup(encoding)
257 except Exception:
258 encoding = "ascii"
259 return encoding
260
261
262DEFAULT_LOCALE_ENCODING = get_system_encoding()

Callers 2

encoding.pyFile · 0.85

Calls

no outgoing calls

Tested by 1