summaryrefslogtreecommitdiffstats
path: root/Objects
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-01-03 00:21:07 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-01-03 00:21:07 (GMT)
commit7ae320d66787e2b4dec293350ec379d5d04fe81b (patch)
tree4eff8b8fc76237c4d7eac384d93597083d5fdc04 /Objects
parent791e464f75bec3829c5e9351b728bb78b0ec0719 (diff)
parent20b654acb50cf59a4b8f8058db5f6b8162bdb91b (diff)
downloadcpython-7ae320d66787e2b4dec293350ec379d5d04fe81b.zip
cpython-7ae320d66787e2b4dec293350ec379d5d04fe81b.tar.gz
cpython-7ae320d66787e2b4dec293350ec379d5d04fe81b.tar.bz2
(Merge 3.2) Issue #16455: On FreeBSD and Solaris, if the locale is C, the
ASCII/surrogateescape codec is now used, instead of the locale encoding, to decode the command line arguments. This change fixes inconsistencies with os.fsencode() and os.fsdecode() because these operating systems announces an ASCII locale encoding, whereas the ISO-8859-1 encoding is used in practice.
Diffstat (limited to 'Objects')
-rw-r--r--Objects/unicodeobject.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 0b9d652..3b307ed 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -3045,8 +3045,8 @@ PyUnicode_FromEncodedObject(register PyObject *obj,
/* Convert encoding to lower case and replace '_' with '-' in order to
catch e.g. UTF_8. Return 0 on error (encoding is longer than lower_len-1),
1 on success. */
-static int
-normalize_encoding(const char *encoding,
+int
+_Py_normalize_encoding(const char *encoding,
char *lower,
size_t lower_len)
{
@@ -3090,7 +3090,7 @@ PyUnicode_Decode(const char *s,
char lower[11]; /* Enough for any encoding shortcut */
/* Shortcuts for common default encodings */
- if (normalize_encoding(encoding, lower, sizeof(lower))) {
+ if (_Py_normalize_encoding(encoding, lower, sizeof(lower))) {
if ((strcmp(lower, "utf-8") == 0) ||
(strcmp(lower, "utf8") == 0))
return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL);
@@ -3455,7 +3455,7 @@ PyUnicode_AsEncodedString(PyObject *unicode,
}
/* Shortcuts for common default encodings */
- if (normalize_encoding(encoding, lower, sizeof(lower))) {
+ if (_Py_normalize_encoding(encoding, lower, sizeof(lower))) {
if ((strcmp(lower, "utf-8") == 0) ||
(strcmp(lower, "utf8") == 0))
{