Message241803
| Author |
serhiy.storchaka |
| Recipients |
eryksun, ezio.melotti, lemburg, serhiy.storchaka, vstinner |
| Date |
2015年04月22日.13:43:35 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1429710216.43.0.46767600072.issue24025@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In Python 2, the unicode() constructor accepts bytes argument if it is decodeable with sys.getdefaultencoding().
>>> unicode(b'abc')
u'abc'
>>> import sys
>>> reload(sys)
<module 'sys' (built-in)>
>>> sys.setdefaultencoding("utf-8")
>>> unicode(u'abcäöü'.encode('utf-8'))
u'abc\xe4\xf6\xfc'
In Python 3, the str() constructor does not accept bytes arguments if Python is ran with -bb option. |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年04月22日 13:43:36 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, lemburg, vstinner, ezio.melotti, eryksun |
| 2015年04月22日 13:43:36 | serhiy.storchaka | set | messageid: <1429710216.43.0.46767600072.issue24025@psf.upfronthosting.co.za> |
| 2015年04月22日 13:43:36 | serhiy.storchaka | link | issue24025 messages |
| 2015年04月22日 13:43:35 | serhiy.storchaka | create |
|