Issue #27781: Change file system encoding on Windows to UTF-8 (PEP 529)
diff --git a/Lib/os.py b/Lib/os.py
index 10d70ad..7379dad 100644
--- a/Lib/os.py
+++ b/Lib/os.py
@@ -851,10 +851,7 @@
 
 def _fscodec():
     encoding = sys.getfilesystemencoding()
-    if encoding == 'mbcs':
-        errors = 'strict'
-    else:
-        errors = 'surrogateescape'
+    errors = sys.getfilesystemencodeerrors()
 
     def fsencode(filename):
         """Encode filename (an os.PathLike, bytes, or str) to the filesystem