Message177416
| Author |
eric.araujo |
| Recipients |
amaury.forgeotdarc, eric.araujo, jkloth, r.david.murray, serhiy.storchaka, techtonik |
| Date |
2012年12月13日.16:45:16 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1355417116.83.0.622257255041.issue16656@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
Anatoly
> b'Русское имя' is not a valid syntax construct in Python 3 even though I have
> correct 'coding: utf-8' header and expect characters to be utf-8 bytes.
David
> The byte string vs the coding cookie is an interesting observation, but is a separate
> issue and should probably be raised on python-ideas, since I'm guessing it the
> current behavior was a conscious design choice.
Yes, it works as designed: the coding cookie is used to decode bytes to characters in unicode literals (e.g. if I have u'Éric' in my source file, not a \u escape); bytes literals are independent of the coding cookie and should always contain only bytes, not characters (including \u escapes), e.g. '\xc3\x89ric' for UTF-8 bytes. |
|