[ python-Bugs-1379994 ] "unicode_escape" and "raw_unicode_escape" encoding is broken

SourceForge.net noreply at sourceforge.net
Sat Dec 17 05:39:26 CET 2005


Bugs item #1379994, was opened at 2005-12-14 09:47
Message generated for change (Settings changed) made by perky
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1379994&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Unicode
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Mark Mc Mahon (markmcmahon)
Assigned to: Hye-Shik Chang (perky)
Summary: "unicode_escape" and "raw_unicode_escape" encoding is broken

Initial Comment:
In Python 2.4.2 and Python 2.4.1 (Windows XP)

>>> "\t\\t".encode("string_escape")
'\\t\\\\t'

>>> "\t\\t".encode("unicode_escape")
'\\t\\t'
>>> "\t\\t".encode("raw_unicode_escape")
'\t\\t'
>>> u"\t\\t".encode("unicode_escape")
'\\t\\t'
>>> u"\t\\t".encode("raw_unicode_escape")
'\t\\t'

I would have expected all to produce the same result.

Also round-tripping with the encoding doesn't seem to work:
>>> "\t\\t".encode('string_escape').decode('string_escape')
'\t\\t'
>>>
u"\t\\t".encode('unicode_escape').decode('unicode_escape')
u'\t\t'

Thanks
   Mark

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

>Comment By: Hye-Shik Chang (perky)
Date: 2005-12-17 13:39

Message:
Logged In: YES 
user_id=55188

Committed as r41728. Thank you!

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

Comment By: M.-A. Lemburg (lemburg)
Date: 2005-12-17 00:01

Message:
Logged In: YES 
user_id=38388

Please add a test case and check in the patch.
Thanks.

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

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-12-16 06:39

Message:
Logged In: YES 
user_id=1188172

Patch looks good.

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

Comment By: Hye-Shik Chang (perky)
Date: 2005-12-14 10:41

Message:
Logged In: YES 
user_id=55188

Attached a patch. It looks like a simple typo. :)

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

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


More information about the Python-bugs-list mailing list