Message5929

Author pjenvey
Recipients pjenvey, rdesgroppes
Date 2010-07-27.23:58:05
SpamBayes Score 3.7297943e-13
Marked as misclassified No
Message-id <1280275087.22.0.440472301858.issue1625@psf.upfronthosting.co.za>
In-reply-to
Content
I think we have all this correct in 2.5.1 (or at least on trunk).

You're wrong about #2:
Jython 2.5.2b1 (trunk:7081M, Jul 27 2010, 16:21:32) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_17
>>> import sys; sys.setdefaultencoding('latin1')
>>> str(u'日本')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 0-1: ordinal not in range(256)

As for #3, our str and unicode objects are backed by java.lang.String. In that respect it makes sense that java.lang.String('foo') or on u'foo' returns the underlying String object, sans any conversion

For #4, str(obj) on arbitrary objects in plain Python always returns the result of obj.__str__. Arbitrary Java objects in Jython by default have __str__ methods which return the result of their toString method. Hence that result
History
Date User Action Args
2010-07-27 23:58:07pjenveysetmessageid: <1280275087.22.0.440472301858.issue1625@psf.upfronthosting.co.za>
2010-07-27 23:58:07pjenveysetrecipients: + pjenvey, rdesgroppes
2010-07-27 23:58:07pjenveylinkissue1625 messages
2010-07-27 23:58:05pjenveycreate