]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix check_force_ascii()
authorVictor Stinner <victor.stinner@gmail.com>
Sat, 10 Sep 2016 06:11:52 +0000 (23:11 -0700)
committerVictor Stinner <victor.stinner@gmail.com>
Sat, 10 Sep 2016 06:11:52 +0000 (23:11 -0700)
Issue #27938: Normalize aliases of the ASCII encoding, because
_Py_normalize_encoding() now correctly normalize encoding names.

Python/fileutils.c

index 7ce3b63306c39b5c3a6ad52ab46d813a61b03848..e3bfb0c502a2d76c1c5b91f05d4d9f68355903d1 100644 (file)
@@ -104,23 +104,24 @@ check_force_ascii(void)
     char *loc;
 #if defined(HAVE_LANGINFO_H) && defined(CODESET)
     char *codeset, **alias;
-    char encoding[100];
+    char encoding[20];   /* longest name: "iso_646.irv_1991\0" */
     int is_ascii;
     unsigned int i;
     char* ascii_aliases[] = {
         "ascii",
+        /* Aliases from Lib/encodings/aliases.py */
         "646",
-        "ansi-x3.4-1968",
-        "ansi-x3-4-1968",
-        "ansi-x3.4-1986",
+        "ansi_x3.4_1968",
+        "ansi_x3.4_1986",
+        "ansi_x3_4_1968",
         "cp367",
         "csascii",
         "ibm367",
-        "iso646-us",
-        "iso-646.irv-1991",
-        "iso-ir-6",
+        "iso646_us",
+        "iso_646.irv_1991",
+        "iso_ir_6",
         "us",
-        "us-ascii",
+        "us_ascii",
         NULL
     };
 #endif