summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-09-10 06:11:52 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-09-10 06:11:52 (GMT)
commit54de2b1edd67ca88c470259d090c8c4cddcadd55 (patch)
treeffc6cb056dd99fdcb53f5b44a213cd5607abf533 /Python
parent11ea04491df185c94c12531c6dba6d46fbcb0ad9 (diff)
downloadcpython-54de2b1edd67ca88c470259d090c8c4cddcadd55.zip
cpython-54de2b1edd67ca88c470259d090c8c4cddcadd55.tar.gz
cpython-54de2b1edd67ca88c470259d090c8c4cddcadd55.tar.bz2
Fix check_force_ascii()
Issue #27938: Normalize aliases of the ASCII encoding, because _Py_normalize_encoding() now correctly normalize encoding names.
Diffstat (limited to 'Python')
-rw-r--r--Python/fileutils.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/Python/fileutils.c b/Python/fileutils.c
index 7ce3b63..e3bfb0c 100644
--- a/Python/fileutils.c
+++ b/Python/fileutils.c
@@ -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