Commit e985c320 authored by Marius Wachtler's avatar Marius Wachtler

PyUnicode treat 'UTF-8' same as 'utf-8'

parent 2cf04700
...@@ -1247,7 +1247,7 @@ PyObject *PyUnicode_Decode(const char *s, ...@@ -1247,7 +1247,7 @@ PyObject *PyUnicode_Decode(const char *s,
encoding = PyUnicode_GetDefaultEncoding(); encoding = PyUnicode_GetDefaultEncoding();
/* Shortcuts for common default encodings */ /* Shortcuts for common default encodings */
if (strcmp(encoding, "utf-8") == 0) if (strcmp(encoding, "utf-8") == 0 || strcmp(encoding, "UTF-8") == 0) // Pyston change: added "UTF-8"
return PyUnicode_DecodeUTF8(s, size, errors); return PyUnicode_DecodeUTF8(s, size, errors);
else if (strcmp(encoding, "latin-1") == 0) else if (strcmp(encoding, "latin-1") == 0)
return PyUnicode_DecodeLatin1(s, size, errors); return PyUnicode_DecodeLatin1(s, size, errors);
...@@ -1359,7 +1359,7 @@ PyObject *PyUnicode_AsEncodedString(PyObject *unicode, ...@@ -1359,7 +1359,7 @@ PyObject *PyUnicode_AsEncodedString(PyObject *unicode,
/* Shortcuts for common default encodings */ /* Shortcuts for common default encodings */
if (errors == NULL) { if (errors == NULL) {
if (strcmp(encoding, "utf-8") == 0) if (strcmp(encoding, "utf-8") == 0 || strcmp(encoding, "UTF-8") == 0) // Pyston change: added "UTF-8"
return PyUnicode_AsUTF8String(unicode); return PyUnicode_AsUTF8String(unicode);
else if (strcmp(encoding, "latin-1") == 0) else if (strcmp(encoding, "latin-1") == 0)
return PyUnicode_AsLatin1String(unicode); return PyUnicode_AsLatin1String(unicode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment