Message237209
What about just 's = unicode(s)'? The doc says
"object.__unicode__(self)
Called to implement unicode() built-in; should return a Unicode object. When this method is not defined, string conversion is attempted, and the result of string conversion is converted to Unicode using the system default encoding."
but the latter part seems not to be true for unicode subclasses.
>>> class F(unicode):
def __str__(self): raise TypeError()
>>> f = F()
>>> u = unicode(f)
>>> type(u)
<type 'unicode'> |
|
Date |
User |
Action |
Args |
2015-03-04 20:43:13 | terry.reedy | set | recipients:
+ terry.reedy, mjpieters, vstinner, ned.deily, ezio.melotti, serhiy.storchaka |
2015-03-04 20:43:13 | terry.reedy | set | messageid: <1425501793.5.0.113266432131.issue23583@psf.upfronthosting.co.za> |
2015-03-04 20:43:13 | terry.reedy | link | issue23583 messages |
2015-03-04 20:43:13 | terry.reedy | create | |
|