can't get utf8 / unicode strings from embedded python

Dave Angel davea at davea.name
Sat Aug 24 03:04:41 EDT 2013


David M. Cotter wrote:
> Steven wrote:
>> I see you are using Python 2
> correct
>
>>It's hard to say what *exactly* is happening here, because you don't explain how the python print statement somehow gets into your C++ Log code. Do I guess right that it catches stdout?
> yes, i'm redirecting stdout to my own custom print class, and then from that function i call into my embedded C++ print function
>

I don't know much about embedding Python, but each file object has an
encoding property.

Why not examine   sys.stdout.encoding ?  And change it to "UTF-8" ?

print "encoding is", sys.stdout.encoding

sys.stdout.encoding = "UTF-8"

-- 
DaveA






More information about the Python-list mailing list