Skip to content

Commit 0d4e01c

Browse files
committed
Issue #13916: Fix surrogatepass error handler on Windows
1 parent b96ebd4 commit 0d4e01c

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

Lib/test/test_codecs.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2841,12 +2841,6 @@ def test_cp1252(self):
28412841
(b'abc', 'strict', 'abc'),
28422842
(b'\xe9\x80', 'strict', '\xe9\u20ac'),
28432843
(b'\xff', 'strict', '\xff'),
2844-
# invalid bytes
2845-
(b'[\x98]', 'strict', None),
2846-
(b'[\x98]', 'ignore', '[]'),
2847-
(b'[\x98]', 'replace', '[\ufffd]'),
2848-
(b'[\x98]', 'surrogateescape', '[\udc98]'),
2849-
(b'[\x98]', 'surrogatepass', None),
28502844
))
28512845

28522846
def test_cp_utf7(self):

Python/codecs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,10 @@ get_standard_encoding(const char *encoding, int *bytelength)
960960
}
961961
}
962962
}
963+
else if (strcmp(encoding, "CP_UTF8") == 0) {
964+
*bytelength = 3;
965+
return ENC_UTF8;
966+
}
963967
return ENC_UNKNOWN;
964968
}
965969

0 commit comments

Comments
 (0)