Hi,

I am confused by unicode_escape functionality - it doesn't  seem to
follow string_escape functionality.

I would expect that given the same string (or at least a non-unicode
and unicode string appropriately) that they would produce more or less
the same output, but:

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

(I would have expected "\\t\\\\t" )

and then round - tripping also seems to be broken for unicode_escape:
>>> "\t\\t".encode('string_escape').decode('string_escape')
'\t\\t'
>>> u"\t\\t".encode('unicode_escape').decode('unicode_escape')
u'\t\t'

Python Version "Python 2.4.2 (#67, Sep 28 2005, 12:41:11) [MSC v.1310
32 bit (Intel)] on win32"

Thanks
    Mark

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to