diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 10:34:05 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2013-10-29 10:34:05 (GMT) |
commit | fa3ba4c3bc31e8d1b78d0f8f97b1b6140ffcbaef (patch) | |
tree | cecbddba48ec67b9139a760fd3b161f9d495b759 | |
parent | bebba5059c67919b2099b4ac089401a823230bab (diff) | |
download | cpython-fa3ba4c3bc31e8d1b78d0f8f97b1b6140ffcbaef.zip cpython-fa3ba4c3bc31e8d1b78d0f8f97b1b6140ffcbaef.tar.gz cpython-fa3ba4c3bc31e8d1b78d0f8f97b1b6140ffcbaef.tar.bz2 |
Issue #18609: Add a fast-path for "iso8859-1" encoding
On AIX, the locale encoding may be "iso8859-1", which was not a known syntax of
the legacy ISO 8859-1 encoding.
Using a C codec instead of a Python codec is faster but also avoids tricky
issues during Python startup or complex code.
-rw-r--r-- | Objects/unicodeobject.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index 87c6472..a7ea9c8 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -3021,7 +3021,8 @@ PyUnicode_Decode(const char *s, return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL); else if ((strcmp(lower, "latin-1") == 0) || (strcmp(lower, "latin1") == 0) || - (strcmp(lower, "iso-8859-1") == 0)) + (strcmp(lower, "iso-8859-1") == 0) || + (strcmp(lower, "iso8859-1") == 0)) return PyUnicode_DecodeLatin1(s, size, errors); #ifdef HAVE_MBCS else if (strcmp(lower, "mbcs") == 0) @@ -3392,7 +3393,8 @@ PyUnicode_AsEncodedString(PyObject *unicode, } else if ((strcmp(lower, "latin-1") == 0) || (strcmp(lower, "latin1") == 0) || - (strcmp(lower, "iso-8859-1") == 0)) + (strcmp(lower, "iso-8859-1") == 0) || + (strcmp(lower, "iso8859-1") == 0)) return _PyUnicode_AsLatin1String(unicode, errors); #ifdef HAVE_MBCS else if (strcmp(lower, "mbcs") == 0) |