News for hackers. Stuff that matters.
Re:How to Use UTF-8 with Python by krosaen on Friday December 02, 2011 @04:56PM (#3305867)
some useful helpers from tornado's escape.py:

    def utf8(value):
        if isinstance(value, unicode):
            return value.encode("utf-8")
        assert isinstance(value, str)
        return value

    def _unicode(value):
        if isinstance(value, str):
            return value.decode("utf-8")
        assert isinstance(value, unicode)
        return value

There are no comments on this comment yet.