summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/test/support/__init__.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py
index f90212c..05e8593 100644
--- a/Lib/test/support/__init__.py
+++ b/Lib/test/support/__init__.py
@@ -871,7 +871,11 @@ for character in (
'\u20AC',
):
try:
- os.fsdecode(os.fsencode(character))
+ # If Python is set up to use the legacy 'mbcs' in Windows,
+ # 'replace' error mode is used, and encode() returns b'?'
+ # for characters missing in the ANSI codepage
+ if os.fsdecode(os.fsencode(character)) != character:
+ raise UnicodeError
except UnicodeError:
pass
else: