fixed an error with utf-8 chars in color profile names

This commit is contained in:
d-schmidt 2013-01-10 20:07:28 +01:00
parent b48257e259
commit 45a97bb430
2 changed files with 7 additions and 5 deletions

View File

@ -522,19 +522,19 @@ static struct PyMethodDef cms_profile_methods[] = {
static PyObject*
cms_profile_getattr_product_name(CmsProfileObject* self, void* closure)
{
return PyUnicode_FromString(cmsTakeProductName(self->profile));
return PyUnicode_DecodeFSDefault(cmsTakeProductName(self->profile));
}
static PyObject*
cms_profile_getattr_product_desc(CmsProfileObject* self, void* closure)
{
return PyUnicode_FromString(cmsTakeProductDesc(self->profile));
return PyUnicode_DecodeFSDefault(cmsTakeProductDesc(self->profile));
}
static PyObject*
cms_profile_getattr_product_info(CmsProfileObject* self, void* closure)
{
return PyUnicode_FromString(cmsTakeProductInfo(self->profile));
return PyUnicode_DecodeFSDefault(cmsTakeProductInfo(self->profile));
}
static PyObject*
@ -546,13 +546,13 @@ cms_profile_getattr_rendering_intent(CmsProfileObject* self, void* closure)
static PyObject*
cms_profile_getattr_pcs(CmsProfileObject* self, void* closure)
{
return PyUnicode_FromString(findICmode(cmsGetPCS(self->profile)));
return PyUnicode_DecodeFSDefault(findICmode(cmsGetPCS(self->profile)));
}
static PyObject*
cms_profile_getattr_color_space(CmsProfileObject* self, void* closure)
{
return PyUnicode_FromString(findICmode(cmsGetColorSpace(self->profile)));
return PyUnicode_DecodeFSDefault(findICmode(cmsGetColorSpace(self->profile)));
}
/* FIXME: add more properties (creation_datetime etc) */

2
py3.h
View File

@ -30,6 +30,7 @@
#undef PyUnicode_FromStringAndSize
#undef PyUnicode_FromString
#undef PyUnicode_FromFormat
#undef PyUnicode_DecodeFSDefault
#define PyUnicode_AsString PyString_AsString
#define PyUnicode_AS_STRING PyString_AS_STRING
@ -37,6 +38,7 @@
#define PyUnicode_FromStringAndSize PyString_FromStringAndSize
#define PyUnicode_FromString PyString_FromString
#define PyUnicode_FromFormat PyString_FromFormat
#define PyUnicode_DecodeFSDefault PyString_FromString
#endif
/* Map PyBytes -> PyString */