Tiny Core Extensions > TCE Bugs
python2.7.10 unicode
(1/1)
limeblack:
Could someone please fix the python tcz so that it sets the default encoding to unicode.
There are several different ways to do it according to the following http://www.ianbicking.org/illusive-setdefaultencoding.html
I edited the following file to get it to work
rm /usr/local/lib/python2.7/SocketServer.py
cp /tmp/tcloop/python/usr/local/lib/python2.7/SocketServer.py /usr/local/lib/python2.7/SocketSerever.py
Then you remove `import sys` from `/usr/local/lib/python2.7/SocketServer.py` and add the following to the top
import sys
reload(sys)
sys.setdefaultencoding('utf8')
bmarkus:
It is really a bad idea to change default behaviour of Python, it would cause many problems, so no sense to change the extension in the repo for that.
If you need a hacked version, hack yourself your own copy. But much better to move to Python 3.4 or 3.5
limeblack:
@bmarkus
Unicode is the default in Python 3.
Unicode is backwards compatible with ascii. 'ascii' is the current default.
In my opinion this a bug unless you can give an example where it breaks code.
bmarkus:
Opening post was a request to patch Python 2.7.10 in the repo to change default encoding. It can brake many existing applications expecting str type and converting it to other type. If a Python script need a patched Python through it away or fix. But do not patch Python itself even not for yourself. It has nothing to do with examples requested.
Navigation
[0] Message Index
Go to full version