#254 UnicodeEncodeError with ?debug=1 and unciode query

closed-fixed
Oleg Broytman
General (125)
5
2009-09-25
2009-09-23
greg
No

If in the connection string ?debug=1 is enabled and the select query is unicode, then a UnicodeEncodeError is thrown:

File "/usr/lib/python2.5/site-packages/sqlobject/sresults.py", line 179, in __iter__
return iter(list(self.lazyIter()))
File "/usr/lib/python2.5/site-packages/sqlobject/sresults.py", line 187, in lazyIter
return conn.iterSelect(self)
File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 395, in iterSelect
select, keepConnection=False)
File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 633, in __init__
dbconn.printDebug(rawconn, self.query, 'Select')
File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 324, in printDebug
self.debugWriter.write(msg)
File "/usr/lib/python2.5/site-packages/sqlobject/dbconnection.py", line 35, in write
self.logfile.write(text + '\n')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xd6' in position 56: ordinal not in range(128)

See in the attachment a test case wich demonstrates the error case and the ok case.
Tested on Version 0.10.2

Discussion

  • greg
    greg
    2009-09-23

    test case error demonstrattion

     
    Attachments
  • Oleg Broytman
    Oleg Broytman
    2009-09-25

    Fixed in the revisions 3992-3994 (branches 0.10, 0.11 and the trunk). Will be in the next round of releases. Thank you!

     
  • Oleg Broytman
    Oleg Broytman
    2009-09-25

    • assigned_to: nobody --> phd
    • status: open --> closed-fixed