We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

sys.getfilesystemencoding

getfilesystemencoding()

Return the name of the encoding used to convert Unicode filenames into system file names, or None if the system default encoding is used. The result value depends on the operating system:

  • On Windows 9x, the encoding is “mbcs”.
  • On Mac OS X, the encoding is “utf-8”.
  • On Unix, the encoding is the user’s preference according to the result of nl_langinfo(CODESET), or None if the nl_langinfo(CODESET) failed.
  • On Windows NT+, file names are Unicode natively, so no conversion is performed. sys.getfilesystemencoding still returns “mbcs”, as this is the encoding that applications should use when they explicitly want to convert Unicode strings to byte strings that are equivalent when used as file names.

New in version 2.3.