summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2007-10-27 05:40:06 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2007-10-27 05:40:06 (GMT)
commit3d7a90dea101021f846173b03b3d0a9c25a9d6b1 (patch)
treecc1c80afa1986881906f8012e0427dcba8a5fb67 /Modules/_localemodule.c
parent8866e0ab58a549704818fb3bdc38a91e03d2180d (diff)
downloadcpython-3d7a90dea101021f846173b03b3d0a9c25a9d6b1.zip
cpython-3d7a90dea101021f846173b03b3d0a9c25a9d6b1.tar.gz
cpython-3d7a90dea101021f846173b03b3d0a9c25a9d6b1.tar.bz2
Get the locale and pwd tests working on the Solaris box where there
are some unicode values used. I'm not sure if this is the correct on all operating systems, but this works on Linux w/o unicode.
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 7c816ff..f9c48e1 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -143,7 +143,7 @@ PyLocale_localeconv(PyObject* self)
involved herein */
#define RESULT_STRING(s)\
- x = PyUnicode_FromString(l->s);\
+ x = PyUnicode_DecodeUnicodeEscape(l->s, strlen(l->s), "strict");\
if (!x) goto failed;\
PyDict_SetItemString(result, #s, x);\
Py_XDECREF(x)
@@ -471,8 +471,10 @@ PyLocale_nl_langinfo(PyObject* self, PyObject* args)
/* Check NULL as a workaround for GNU libc's returning NULL
instead of an empty string for nl_langinfo(ERA). */
const char *result = nl_langinfo(item);
+ result = result != NULL ? result : "";
/* XXX may have to convert this to wcs first. */
- return PyUnicode_FromString(result != NULL ? result : "");
+ return PyUnicode_DecodeUnicodeEscape(result, strlen(result),
+ "strict");
}
PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant");
return NULL;