FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Fix check_force_ascii() · python/cpython@54de2b1 · GitHub

Repository navigation

Commit 54de2b1

Browse files
committed
Fix check_force_ascii()
Issue #27938: Normalize aliases of the ASCII encoding, because _Py_normalize_encoding() now correctly normalize encoding names.
1 parent 11ea044 commit 54de2b1

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

‎Python/fileutils.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,24 @@ check_force_ascii(void)
104104
char *loc;
105105
#if defined(HAVE_LANGINFO_H) && defined(CODESET)
106106
char *codeset, **alias;
107-
char encoding[100];
107+
char encoding[20]; /* longest name: "iso_646.irv_1991\0" */
108108
int is_ascii;
109109
unsigned int i;
110110
char* ascii_aliases[] = {
111111
"ascii",
112+
/* Aliases from Lib/encodings/aliases.py */
112113
"646",
113-
"ansi-x3.4-1968",
114-
"ansi-x3-4-1968",
115-
"ansi-x3.4-1986",
114+
"ansi_x3.4_1968",
115+
"ansi_x3.4_1986",
116+
"ansi_x3_4_1968",
116117
"cp367",
117118
"csascii",
118119
"ibm367",
119-
"iso646-us",
120-
"iso-646.irv-1991",
121-
"iso-ir-6",
120+
"iso646_us",
121+
"iso_646.irv_1991",
122+
"iso_ir_6",
122123
"us",
123-
"us-ascii",
124+
"us_ascii",
124125
NULL
125126
};
126127
#endif

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL