simpler unicode to char*
This commit is contained in:
@ -295,10 +295,10 @@ static PyObject* pyField_putval(pyField *self, PyObject* args)
|
|||||||
const char *fld;
|
const char *fld;
|
||||||
char *dest=rawfield;
|
char *dest=rawfield;
|
||||||
#if PY_MAJOR_VERSION >= 3
|
#if PY_MAJOR_VERSION >= 3
|
||||||
PyObject *data = PyUnicode_AsEncodedString(val, "ascii", "Encoding error:");
|
PyObject *data = PyUnicode_AsASCIIString(val);
|
||||||
if(!data)
|
if(!data)
|
||||||
return NULL;
|
return NULL;
|
||||||
fld = PyUnicode_AS_DATA(data);
|
fld = PyBytes_AS_STRING(data);
|
||||||
#else
|
#else
|
||||||
fld = PyString_AsString(val);
|
fld = PyString_AsString(val);
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user