3
* John Dennis <jdennis@redhat.com>
5
* Copyright (C) 2009 Red Hat
6
* see file 'COPYING' for use and warranty information
8
* This program is free software you can redistribute it and/or modify
9
* it under the terms of the GNU General Public License as published by
10
* the Free Software Foundation, either version 3 of the License, or
11
* (at your option) any later version.
13
* This program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public License
19
* along with this program. If not, see <http://www.gnu.org/licenses/>.
24
PyDoc_STRVAR(setdefaultencoding_doc,
25
"setdefaultencoding(encoding='utf-8')\n\
27
Set the current default string encoding used by the Unicode implementation.\n\
32
setdefaultencoding(PyObject *self, PyObject *args, PyObject *kwds)
34
static char *kwlist[] = {"utf-8", NULL};
37
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s:setdefaultencoding", kwlist, &encoding))
40
if (PyUnicode_SetDefaultEncoding(encoding))
46
static PyMethodDef methods[] = {
47
{"setdefaultencoding", (PyCFunction)setdefaultencoding, METH_VARARGS|METH_KEYWORDS, setdefaultencoding_doc},
48
{NULL, NULL} /* sentinel */
53
initdefault_encoding_utf8(void)
55
PyUnicode_SetDefaultEncoding("utf-8");
56
Py_InitModule3("default_encoding_utf8", methods, "Forces the default encoding to utf-8");