[Ironpython-users] IronPython, Daily Digest 1/4/2014

CodePlex no_reply at codeplex.com
Sun Jan 5 09:20:02 CET 2014


Hi ironpython,

Here's your Daily Digest of new issues for project "IronPython".

In today's digest:ISSUES

1. [New issue] unicode.encode() returns wrong type

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

ISSUES

1. [New issue] unicode.encode() returns wrong type
http://ironpython.codeplex.com/workitem/34842
User bdarnell has proposed the issue:

"IronPython (2.7.4) has both unicode and byte strings, with str as an alias for unicode (python 3 style) instead of bytes (as it is in cpython 2.7).  So far so good.  However, the encode/decode methods for converting between the two don't work as expected:  u'\u00e9'.encode('utf8') returns the unicode string '\xc3\xa9', instead of a byte string (bytes.decode('utf8') returns a unicode string as expected).  This means it is impossible to use isinstance(s, unicode) to determine whether you are dealing with a unicode string that needs to be encoded or a byte string that has already been encoded.

This isinstance pattern is used extensively in some Python libraries (e.g. Tornado), so these libraries cannot be used with IronPython unless this is fixed.  unicode.encode() should always return byte strings.  bytes.decode() should mostly return unicode strings (which it already does) except for a few bytes-to-bytes oddities like the base64 codec (which were removed in python 3)."
----------------------------------------------



----------------------------------------------
You are receiving this email because you subscribed to notifications on CodePlex.

To report a bug, request a feature, or add a comment, visit IronPython Issue Tracker. You can unsubscribe or change your issue notification settings on CodePlex.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20140105/34074dfd/attachment.html>


More information about the Ironpython-users mailing list