[issue17850] unicode_escape encoding fails for '\\Upsilon'

Ezio Melotti report at bugs.python.org
Fri Apr 26 15:47:57 CEST 2013


Ezio Melotti added the comment:

This is not a bug, \U should be followed by 8 hex digits and it indicates a Unicode codepoint:
>>> '\\u0065'.decode('unicode_escape')
u'e'
>>> '\\U00000065'.decode('unicode_escape')
u'e'
>>> '\\Upsilon'.decode('unicode_escape')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 0-7: end of string in escape sequence
>>> u'\Upsilon'
  File "<stdin>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 0-7: end of string in escape sequence
>>> u'\U00000065'
u'e'

----------
nosy: +ezio.melotti
resolution:  -> invalid
stage:  -> committed/rejected
status: open -> closed
type: crash -> behavior

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17850>
_______________________________________


More information about the Python-bugs-list mailing list