from cpython.unicode cimport PyUnicode_DecodeUTF8, PyUnicode_AsUTF8String

cdef inline to_unicode(char *s):
	try:
		ns = PyUnicode_DecodeUTF8(s, len(s), NULL)
	except:
		ns = s
	return ns

cdef inline from_unicode(object o):
	if isinstance(o, unicode):
		return PyUnicode_AsUTF8String(o)
	else:
		return o

from cpython.unicode cimport PyUnicode_DecodeUTF8, PyUnicode_AsUTF8String
from libc.string cimport const_char, strlen

cdef inline to_unicode(const_char *s):
	return PyUnicode_DecodeUTF8(s, strlen(s), "replace")

cdef inline from_unicode(object o):
	if isinstance(o, unicode):
		return PyUnicode_AsUTF8String(o)
	else:
		return o

Fix string constness in to_unicode
OTHER: Fix string constness in to_unicode
