summaryrefslogtreecommitdiffstats
path: root/Modules/_localemodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2007-08-11 14:02:14 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2007-08-11 14:02:14 (GMT)
commitd1cd4d41762ba55bfa121875fbcbde19fb6a35f1 (patch)
treeefc776f69cdf44259a96e12ada8ea14dbe9e0362 /Modules/_localemodule.c
parent79c320898d43eaafa28c1c67a105a17cb9b233bf (diff)
downloadcpython-d1cd4d41762ba55bfa121875fbcbde19fb6a35f1.zip
cpython-d1cd4d41762ba55bfa121875fbcbde19fb6a35f1.tar.gz
cpython-d1cd4d41762ba55bfa121875fbcbde19fb6a35f1.tar.bz2
Set sys.stdout.encoding properly.
Always set LC_CTYPE on interpreter startup. Add device_encoding function.
Diffstat (limited to 'Modules/_localemodule.c')
-rw-r--r--Modules/_localemodule.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/_localemodule.c b/Modules/_localemodule.c
index 6f063fb..233cf02 100644
--- a/Modules/_localemodule.c
+++ b/Modules/_localemodule.c
@@ -1,5 +1,5 @@
/***********************************************************
-Copyright (C) 1997, 2002, 2003 Martin von Loewis
+Copyright (C) 1997, 2002, 2003, 2007 Martin von Loewis
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
@@ -562,7 +562,8 @@ 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);
- return PyString_FromString(result != NULL ? result : "");
+ /* XXX may have to convert this to wcs first. */
+ return PyUnicode_FromString(result != NULL ? result : "");
}
PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant");
return NULL;