Issue #8622: Add PYTHONFSENCODING environment variable to override the
filesystem encoding.

initfsencoding() displays also a better error message if get_codeset() failed.
diff --git a/Lib/test/test_pep277.py b/Lib/test/test_pep277.py
index 60d99db..0699317 100644
--- a/Lib/test/test_pep277.py
+++ b/Lib/test/test_pep277.py
@@ -43,7 +43,7 @@
 
 # Is it Unicode-friendly?
 if not os.path.supports_unicode_filenames:
-    fsencoding = sys.getfilesystemencoding() or sys.getdefaultencoding()
+    fsencoding = sys.getfilesystemencoding()
     try:
         for name in filenames:
             name.encode(fsencoding)