Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

I want to use utf-8 with python 2.7

I am using Python 2.7.15rc1 (default, Nov 12 2018, 14:31:15).

I'd like to change the encoding from the default ascii toutf-8.

Please lend me your knowledge.

What I did:

Seach:UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)

Console:

    >>> import sys
    >>> sys.getdefaultencode
        Traceback (most recent call last):
          File "<stdin>", line 1, in <module>
        AttributeError: 'module' object has no attribute 'getdafaultencoding'

My ~/python2.7/site-packages/sitecustomize.py

    import sys
    reload(sys)
    sys.getdefaultencoding("utf-8")

Thank you.

Comments