]> granicus.if.org Git - python/commitdiff
Issue #13916: Fix surrogatepass error handler on Windows
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 16 May 2014 12:46:20 +0000 (14:46 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 16 May 2014 12:46:20 +0000 (14:46 +0200)
Lib/test/test_codecs.py
Python/codecs.c

index e4d7a601d0472d7c0a0813440b855c29a9902506..f59c37d120f6dfbcf6c31b1c0ee0f2b0ba36bca1 100644 (file)
@@ -2841,12 +2841,6 @@ class CodePageTest(unittest.TestCase):
             (b'abc', 'strict', 'abc'),
             (b'\xe9\x80', 'strict', '\xe9\u20ac'),
             (b'\xff', 'strict', '\xff'),
-            # invalid bytes
-            (b'[\x98]', 'strict', None),
-            (b'[\x98]', 'ignore', '[]'),
-            (b'[\x98]', 'replace', '[\ufffd]'),
-            (b'[\x98]', 'surrogateescape', '[\udc98]'),
-            (b'[\x98]', 'surrogatepass', None),
         ))
 
     def test_cp_utf7(self):
index 700313633e160835b51799da9b3343138e8e4483..4c2ae381b36d7047e6a4f45cb86232beac6a1de6 100644 (file)
@@ -960,6 +960,10 @@ get_standard_encoding(const char *encoding, int *bytelength)
             }
         }
     }
+    else if (strcmp(encoding, "CP_UTF8") == 0) {
+        *bytelength = 3;
+        return ENC_UTF8;
+    }
     return ENC_UNKNOWN;
 }