[Python-bugs-list] [ python-Bugs-587087 ] ur'\u' not handled properly

noreply@sourceforge.net noreply@sourceforge.net
Fri, 26 Jul 2002 09:31:20 -0700


Bugs item #587087, was opened at 2002-07-26 16:05
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=587087&group_id=5470

Category: Parser/Compiler
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Jeff Epler (jepler)
>Assigned to: Fred L. Drake, Jr. (fdrake)
Summary: ur'\u' not handled properly

Initial Comment:
according to
http://www.python.org/doc/current/ref/strings.html, no
\-escapes have a meaning inside raw strings.

However, \u seems to be interpreted:
>>> ur'\u'
UnicodeError: Unicode-Escape decoding error: truncated
\uXXXX
>>> ur'\u0100'
u'\u0100'

I would expect the values to be
u'\u'
u'\u0100'

Tested in 2.3a0 from <2 weeks ago and python 2.2.

----------------------------------------------------------------------

>Comment By: M.-A. Lemburg (lemburg)
Date: 2002-07-26 16:31

Message:
Logged In: YES 
user_id=38388

I suppose this is a documentation bug. According to PEP 100:

    u = ur'<raw-unicode-escape encoded Python string>'

    The 'raw-unicode-escape' encoding is defined as follows:

    - \uXXXX sequence represent the U+XXXX Unicode character
if and
      only if the number of leading backslashes is odd

    - all other characters represent themselves as Unicode
ordinal
      (e.g. 'b' -> U+0062)

Assigned to Fred.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=587087&group_id=5470