From python-cpp-sig Mon Feb 21 13:33:03 2011 From: Hans Meine Date: Mon, 21 Feb 2011 13:33:03 +0000 To: python-cpp-sig Subject: Re: [C++-sig] Creating a unicode instrance from utf-8 encoded string Message-Id: <201102211433.03756.hans_meine () gmx ! net> X-MARC-Message: https://marc.info/?l=python-cpp-sig&m=129829522032441 Am Montag, 21. Februar 2011, um 11:36:52 schrieb Wichert Akkerman: > I'm trying to do something which should be very simple, but I'm not > having much luck figuring out how from the existing documentation. > > For a python 2 project I am trying to return a gettext-translated string > as a unicode instance to python. The return value for gettext() is a > UTF-8 encoded char*, which should be pretty simple to convert to a > python unicode instrance using PyUnicode_FromString. I have a feeling > this is trivial to do, but I can't seem to figure out how. According to http://docs.python.org/c-api/unicode.html , this is exactly what PyUnicode_FromString is supposed to do. What's the problem? Do you get an error? Some code might help. HTH, Hans _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig