I ran into some Unicode errors in Python trying to print some strings and I solved most of it using the following code from the second bullet point of the answer given in the following post: UnicodeEncodeError: 'charmap' codec can't encode - character maps to <undefined>, print function
# -*- coding: utf-8 -*-
import sys
print sys.stdout.encoding
print u"Stöcker".encode(sys.stdout.encoding, errors='replace')
print u"Стоескер".encode(sys.stdout.encoding, errors='replace')
However, I get an error while trying to use this on a list object. It gives me an error that the list does not have the attribute "encode".
Does someone have a clean solution to get around this?
Any help is appreciated!