From: Victor Stinner Date: Sat, 10 Sep 2016 06:11:52 +0000 (-0700) Subject: Fix check_force_ascii() X-Git-Tag: v3.6.0b1~106 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54de2b1edd67ca88c470259d090c8c4cddcadd55;p=thirdparty%2FPython%2Fcpython.git Fix check_force_ascii() Issue #27938: Normalize aliases of the ASCII encoding, because _Py_normalize_encoding() now correctly normalize encoding names. --- diff --git a/Python/fileutils.c b/Python/fileutils.c index 7ce3b63306c3..e3bfb0c502a2 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