sys.getfilesystemencoding
Prev: sys.getfilesystemencodeerrors | Up: sys | Next: sys.getprofile
Rel: sys.activate_stack_trampoline, sys.addaudithook, sys.audit, sys.breakpointhook
Ref: docs.python.org — sys.getfilesystemencoding
Tags: #public #python3 #stdlib #sys
Import
import sys
from sys import getfilesystemencoding
Signature & Overview
sys.getfilesystemencoding()
Return the encoding used to convert Unicode filenames to OS filenames.
Usage
import sys
enc = sys.getfilesystemencoding()
assert isinstance(enc, str) and len(enc) > 0
Gotchas
- Encoding used by
os.fsencode()/os.fsdecode(): Usually"utf-8"on macOS, Windows, and modern Linux.
REPL Inspect
from sys import getfilesystemencoding
help(getfilesystemencoding)
Linked from
Related notes
- tuts/python3/stdlib_module/sys/getfilesystemencodeerrors Linked here; links to this page; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/getprofile Linked here; links to this page; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/sys/activate_stack_trampoline Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/addaudithook Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/audit Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/breakpointhook Linked here; shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/call_tracing shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/deactivate_stack_trampoline shared tags: #stdlib, #sys
- tuts/python3/stdlib_module/sys/displayhook shared tags: #stdlib, #sys