Message82960
| Author |
ezio.melotti |
| Recipients |
ezio.melotti, t.steinruecken |
| Date |
2009年03月01日.13:00:45 |
| SpamBayes Score |
1.9899082e-12 |
| Marked as misclassified |
No |
| Message-id |
<1235912448.02.0.210374864832.issue5398@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
I don't have the de_DE locale to reproduce that, but the cause is most
likely this:
1) datetime( 2009, 3, 1 ).strftime("%B") should return märz as a UTF-8
encoded string, i.e. 'm\xc3\xa4rz'
2) when you mix Unicode and encoded strings, the encoded strings are
automagically decoded to Unicode using the default codec, i.e. ASCII (on
Py2)
3) The ASCII codec is not able to decode '\xc3' (its value is 195, and
195 > 127) and a UnicodeDecodeError is raised.
The solution is to decode the string explicitly using UTF-8:
>>> month = 'm\xc3\xa4rz'
>>> u'' + month
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1:
ordinal not in range(128)
>>> u'' + month.decode('utf-8')
u'm\xe4rz'
>>> |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2009年03月01日 13:00:48 | ezio.melotti | set | recipients:
+ ezio.melotti, t.steinruecken |
| 2009年03月01日 13:00:48 | ezio.melotti | set | messageid: <1235912448.02.0.210374864832.issue5398@psf.upfronthosting.co.za> |
| 2009年03月01日 13:00:46 | ezio.melotti | link | issue5398 messages |
| 2009年03月01日 13:00:45 | ezio.melotti | create |
|