Title: unicode string combination with % behaves unexpectedly
Type: behaviour Severity: normal
Components: Core Versions: 2.5alpha1
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: amak, fwierzbicki, leosoto, seamus
Priority: Keywords:

Created on 2008-03-26.22:31:32 by seamus, last changed 2008-09-13.16:21:41 by leosoto.

File name Uploaded Description Edit Remove seamus, 2008-03-26.22:31:31 A simple test that fails w/jython. Works w/CPython
msg3106 (view) Author: seamus (seamus) Date: 2008-03-26.22:31:31
Jython 2.2.1 on java1.6.0_03

the % operator for string concatenation behaves unexpectedly for unicode
strings. I suspect this is a bug.

  File "/tmp/", line 20, in ?
UnicodeError: ascii decoding error: ordinal not in range(128)
msg3107 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2008-03-26.23:31:56
This is an issue with the pep 263 support which is a 2.3 feature.  The
prod version of Jython (2.2) will not support this, but future versions
will.  I've set the version to 2.5alpha1 to reflect this.
msg3108 (view) Author: seamus (seamus) Date: 2008-03-27.13:30:26
Even without the pep 263 feature,
unicode strings can be combined with '+' but not '%'.

def getAraLetters():
     return ''.join([unichr(num) for num in xrange(1569,1617)])

newString = u""" The Arabic Letters: """+ getAraLetters()
newString = u""" Here are some Arabic letters %s """ % (getAraLetters())
msg3113 (view) Author: Frank Wierzbicki (fwierzbicki) Date: 2008-04-01.15:31:36
okay -- I've assigned this bug to myself, I'll take a look at the
behavior in 2.2.
msg3503 (view) Author: Leonardo Soto (leosoto) Date: 2008-09-13.16:21:41
Both tests (trouble4Jython and the interactive session posted on the
last message) don't crash anymore on trunk.
Date User Action Args
2008-09-13 16:21:41leosotosetstatus: open -> closed
nosy: + leosoto
resolution: fixed
messages: + msg3503
2008-04-18 12:27:08amaksetnosy: + amak
2008-04-01 15:31:36fwierzbickisetassignee: fwierzbicki
messages: + msg3113
2008-03-27 13:30:27seamussetmessages: + msg3108
2008-03-26 23:31:56fwierzbickisetmessages: + msg3107
versions: + 2.5alpha1, - Deferred
2008-03-26 23:28:19fwierzbickisetnosy: + fwierzbicki
2008-03-26 22:31:32seamuscreate