Return the charset that the user is likely using.
(do_setlocale=True)
| 633 | CODESET |
| 634 | except 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() |
| 645 | else: |
| 646 | # On Unix, if CODESET is available, use that. |
| 647 | def getpreferredencoding(do_setlocale=True): |
nothing calls this directly
no test coverage detected