Dear Marcel,

give this a trial with:

sys.setdefaultencoding("latin1")

or
mystr = mystr.encode('latin1')

Regards,
Claude

Claude Falbriard
Certified IT Specialist L2 - Middleware
AMS Hortolândia / SP - Brazil
phone:    +55 13 9762 4094
cell:         +55 13 8117 3316
e-mail:    claudef@br.ibm.com




From:        marcel liker <m_liker@yahoo.com>
To:        jython-users <jython-users@lists.sourceforge.net>
Date:        13/01/2011 12:27
Subject:        [Jython-users] dbexts UnicodeEncodeError




Hi all,
is the below example expected behavior of dbexts console formater?

>>> db.isql("select * from table where condition)

Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
 File "/home/user/jython252rc2/Lib/dbexts.py", line 332, in isql
   self.display()
 File "/home/user/jython252rc2/Lib/dbexts.py", line 312, in display
   for a in self.formatter(res, map(lambda x: x[0], self.headers)):
 File "/home/user/jython252rc2/Lib/dbexts.py", line 85, in console
   row = map(lambda x: str(x), row)
 File "/home/user/jython252rc2/Lib/dbexts.py", line 85, in <lambda>
   row = map(lambda x: str(x), row)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 11: ordinal not in range(128)

While:

>>> print db.results[0][2]
Ignácio

And from the above trace:

>>> str(prod.results[0][2])
Traceback (most recent call last):
 File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe1' in position 11: ordinal not in range(128)

I also tested this with 2.5.2rc3 and the behavior is the same.

Tested on sles 10 with java1.6.0_14

------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl_______________________________________________
Jython-users mailing list
Jython-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jython-users