summaryrefslogtreecommitdiffstats
path: root/Modules/cjkcodecs
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-17 18:56:39 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-17 18:56:39 (GMT)
commitaf199faa9bcbe73753224f174075693bd98b64ea (patch)
tree60e50b13c4cf3cabdd6fee066655a9fd34791daf /Modules/cjkcodecs
parent583118a535c944002f578ae1449b1c29e2ee3e28 (diff)
downloadcpython-af199faa9bcbe73753224f174075693bd98b64ea.zip
cpython-af199faa9bcbe73753224f174075693bd98b64ea.tar.gz
cpython-af199faa9bcbe73753224f174075693bd98b64ea.tar.bz2
Allow encoding names to be unicode strings.
Diffstat (limited to 'Modules/cjkcodecs')
-rw-r--r--Modules/cjkcodecs/cjkcodecs.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/Modules/cjkcodecs/cjkcodecs.h b/Modules/cjkcodecs/cjkcodecs.h
index 71c54f0..c79b304 100644
--- a/Modules/cjkcodecs/cjkcodecs.h
+++ b/Modules/cjkcodecs/cjkcodecs.h
@@ -261,6 +261,11 @@ getcodec(PyObject *self, PyObject *encoding)
const MultibyteCodec *codec;
const char *enc;
+ if (PyUnicode_Check(encoding)) {
+ encoding = _PyUnicode_AsDefaultEncodedString(encoding, NULL);
+ if (encoding == NULL)
+ return NULL;
+ }
if (!PyString_Check(encoding)) {
PyErr_SetString(PyExc_TypeError,
"encoding name must be a string.");