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