Éric Araujo added the comment:

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.

----------
nosy: +eric.araujo

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue16656>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to