I am calling some sort of API which returns an object with three properties:
obj.name
obj.id
obj.text
all of these could come in different encoding.
In order to output it correctly to my terminal, I am now doing
print obj.name.encode('UTF-8')
print obj.id.encode('UTF-8')
print obj.text.encode('UTF-8')
Is there a way I can simply do one time to set my default encoding to UTF-8?
I read some other post which suggested calling the sys.setdefaultencoding('UTF-8'), which is not available anymore in python 2.7.x
Please advise.