kuuko pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=b6f2a6822f36be6ddc017e4d78bc3d29c8cbe1ee
commit b6f2a6822f36be6ddc017e4d78bc3d29c8cbe1ee Author: Kai Huuhko <kai.huu...@gmail.com> Date: Wed May 14 07:01:57 2014 +0300 efl.ecore.x: Unicode handling --- efl/ecore/x.pyx | 9 +++------ efl/ecore/x_events.pxi | 11 ++++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/efl/ecore/x.pyx b/efl/ecore/x.pyx index ef1bd66..d75c587 100644 --- a/efl/ecore/x.pyx +++ b/efl/ecore/x.pyx @@ -17,6 +17,7 @@ #from cpython cimport PyObject, Py_INCREF, Py_DECREF from cpython cimport PyMem_Malloc, PyMem_Free +from libc.string cimport PyUnicode_AsUTF8String def init(name=None): @@ -25,13 +26,9 @@ def init(name=None): :param name: display target name, if None, default will be used. :rtype: int """ - cdef char *s cdef int i - if name is None: - s = NULL - else: - s = name - i = ecore_x_init(s) + if isinstance(name, unicode): name = PyUnicode_AsUTF8String(name) + i = ecore_x_init(s if name is not None else NULL) x_events_register() return i diff --git a/efl/ecore/x_events.pxi b/efl/ecore/x_events.pxi index 680239e..b605899 100644 --- a/efl/ecore/x_events.pxi +++ b/efl/ecore/x_events.pxi @@ -16,12 +16,13 @@ # along with this Python-EFL. If not, see <http://www.gnu.org/licenses/>. from efl.ecore cimport EventHandler +from efl.utils.conversions cimport _ctouni as _charp_to_str -cdef object _charp_to_str(const char *p): - if p != NULL: - return p - else: - return None +# cdef object _charp_to_str(const char *p): +# if p != NULL: +# return p +# else: +# return None cdef class EventKey(Event): --