bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1… · python/cpython@8752dfb (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 8752dfb
authored and
committed
bpo-33709: test_ntpath and test_posixpath fail in Windows with ACP!=1252. (GH-7278)
File tree
1 file changed
lines changed
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -871,7 +871,11 @@ def dec(*args, **kwargs): | ||
871 | 871 | '\u20AC', |
872 | 872 | ): |
873 | 873 | try: |
874 | -os.fsdecode(os.fsencode(character)) | |
874 | +# If Python is set up to use the legacy 'mbcs' in Windows, | |
875 | +# 'replace' error mode is used, and encode() returns b'?' | |
876 | +# for characters missing in the ANSI codepage | |
877 | +if os.fsdecode(os.fsencode(character)) != character: | |
878 | +raise UnicodeError | |
875 | 879 | except UnicodeError: |
876 | 880 | pass |
877 | 881 | else: |