Index: Lib/test/test_sys.py =================================================================== --- Lib/test/test_sys.py (revision 81886) +++ Lib/test/test_sys.py (working copy) @@ -868,6 +868,15 @@ if sys.platform == 'darwin': self.assertEqual(fs_encoding, 'utf-8') + env = os.environ.copy() + env['LANG'] = 'C' + output = subprocess.check_output( + [sys.executable, "-c", + "import sys; print(sys.getfilesystemencoding())"], + env=env) + fs_encoding = output.strip() + self.assertEqual(fs_encoding, b'utf-8') + def test_setfilesystemencoding(self): old = sys.getfilesystemencoding() try: