pypy-7.1.0 python2.7 sys.setdefaultencoding("utf-8") not supported
i have a simple code:
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
d = u"啊"
d = str(d)
when i run it with pypy7.1.0(https://downloads.python.org/pypy/pypy2.7-v7.1.0-linux64.tar.bz2):
pypy test.py
it raises a exception:
Traceback (most recent call last):
File "enc.py", line 8, in <module>
d = str(d)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u554a' in position 0: ordinal not in range(128)
- if i use python 2.7, there is no error
- if i use pypy7.0, there is no error
is it a bug?