Windows Python: Changing encoding using the locale module
问题 Using Python 2.7 I am writing an abstract web scraper and am having problems when displaying (printing) certain characters. I get the trace-back error: UnicodeEncodeError: 'ascii' codec can't encode character u'\u2606' in position 5: ordinal not in range(128) from printing the string containing the character. I used the locale module to find out my OS supported settings, although I'm not certain I should use locale for my problem, and noticed the default settings where (en_US', 'cp1252') . I