[Ironpython-users] IronPython, Daily Digest 9/19/2012
no_reply at codeplex.com
no_reply at codeplex.com
Thu Sep 20 17:15:05 CEST 2012
Hi ironpython,
Here's your Daily Digest of new issues for project "IronPython".
In today's digest:ISSUES
1. [New issue] boolean type from databinding is not json compatible
2. [New issue] Lower casing non-ASCII characters does not work
3. [New comment] Lower casing non-ASCII characters does not work
4. [New comment] Lower casing non-ASCII characters does not work
----------------------------------------------
ISSUES
1. [New issue] boolean type from databinding is not json compatible
http://ironpython.codeplex.com/workitem/33134
User barbar01 has proposed the issue:
"You have to cast explicit with bool(a) if a is a boolean set by databinding.
json.dumps(a) would create a small written "true","false" which json could not reload."-----------------
2. [New issue] Lower casing non-ASCII characters does not work
http://ironpython.codeplex.com/workitem/33133
User pekkaklarck has proposed the issue:
"Interestingly upper() works but lower() doesn't. Tested with some Scandinavian letters but not with other scripts.
To reproduce:
IronPython 2.7.3 (2.7.0.40) on .NET 4.0.30319.269 (32-bit)
Type "help", "copyright", "credits" or "license" for more information.
>>> a = u'\xe4' # Character 'ä'
>>> A = a.upper()
>>> A
u'\xc4' # Correctly produces 'Ä'
>>> a.islower()
True
>>> A.islower()
False
>>> A.lower()
u'\xc4' # Wrong! Still 'Ä'
>>> A.lower() == a
False
>>> A.lower() == A
True"-----------------
3. [New comment] Lower casing non-ASCII characters does not work
http://ironpython.codeplex.com/workitem/33133
User pekkaklarck has commented on the issue:
"Very interestingly swapcase() works:
>>> a = u'\xe4'
>>> A = a.upper()
>>> A.swapcase() == a
True
>>> a.swapcase() == A
True
This allowed me to create the following workaround function:
def lower(string):
return ''.join(c if not c.isupper() else c.swapcase() for c in string)
"-----------------
4. [New comment] Lower casing non-ASCII characters does not work
http://ironpython.codeplex.com/workitem/33133
User pekkaklarck has commented on the issue:
"My workaround function was unfortunately slow but could luckily be optimized in common case (including when not running on IronPython). Here's the final code:
if sys.platform != 'cli':
def lower(string):
return string.lower()
else:
def lower(string):
if string.islower():
return string
if not _has_non_ascii_chars(string):
return string.lower()
return ''.join(c if not c.isupper() else c.swapcase() for c in string)
def _has_non_ascii_chars(string):
for c in string:
if c >= u'\x80':
return True
return False
"
----------------------------------------------
----------------------------------------------
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/20120920/473f1830/attachment.html>
More information about the Ironpython-users
mailing list