Author sqxu
Recipients sqxu
Date 2012-01-06.05:45:11
SpamBayes Score 1.71558e-09
Marked as misclassified No
Message-id <>
I am using Jython 2.5.1 and find a strange behavior for assert and print. Pls see the following lines.

1.  assert False == True, u"\u4eee\u60f3\u30a4\u30e1\u30fc\u30b8\u300c"

   Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
   Error in sys.excepthook:
   UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-6: ordinal not in range(128)

2. print u"\u4eee\u60f3\u30a4\u30e1\u30fc\u30b8\u300c"

   output:  仮想イメージ「

3. assert False == True, u"\u4eee\u60f3\u30a4\u30e1\u30fc\u30b8\u300c".encode('utf8')
   Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
  AssertionError: 仮想イメージ「

2 and 3 can show the message correctly, but 1 cannot. Do assert and print have different mechanism to display the message?
BTW, my sys.stdout.encoding is UTF-8.
Date User Action Args
2012-01-06 05:45:12sqxusetrecipients: + sqxu
2012-01-06 05:45:12sqxusetmessageid: <>
2012-01-06 05:45:12sqxulinkissue1830 messages
2012-01-06 05:45:11sqxucreate