Red Hat Bugzilla – Bug 239381
uncorrect handling of encoded strings in cursors.py
Last modified: 2013-07-02 23:12:56 EDT
Description of problem:uncorrect handling of encoded strings in cursors.py
Version-Release number of selected component (if applicable): 1.2.1_p2-1.el4.1
How reproducible:run the script including utf-8 or other non ascii character set.
Steps to Reproduce:see below
DB_Info = dict(host='localhost', user='root', passwd='pass', db='test', charset='utf8')
db = MySQLdb.connect(**DB_Info)
c = db.cursor(MySQLdb.cursors.DictCursor)
c.execute("INSERT INTO some_table (some_fld) VALUES ('%s')" % value_including_non_ascii)
Actual results:Traceback occured with following messages
File "/usr/lib/python2.3/site-packages/MySQLdb/cursors.py", line 146, in execute
query = query.encode(charset)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 108: ordinal not in range(128)
Expected results:"INSERT" SQL is done successful
Created attachment 154308 [details]
patch from http://sourceforge.net/tracker/index.php?func=detail&aid=1521274&group_id=22307&atid=374932
Thank you for submitting this issue for consideration in Red Hat Enterprise Linux. The release for which you requested us to review is now End of Life.
Please See https://access.redhat.com/support/policy/updates/errata/
If you would like Red Hat to re-consider your feature request for an active release, please re-open the request via appropriate support channels and provide additional supporting details about the importance of this issue.