I thought it was default since python 3.
replies(2):
# string literals create str objects using utf-8 by default
Path("filenames use their own encoding").write_text("file content encoding uses yet another encoding")
The corresponding encodings are:- utf-8 [tokenize.open] - sys.getfilesystemencoding() [os.fsencode] - locale.getpreferredencoding() [open]