Bug 239381 - uncorrect handling of encoded strings in cursors.py
uncorrect handling of encoded strings in cursors.py
Status: CLOSED WONTFIX
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: MySQL-python (Show other bugs)
4.5
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Tom Lane
qe-baseos-daemons
http://sourceforge.net/tracker/index....
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2007-05-07 20:42 EDT by ryo fujita
Modified: 2013-07-02 23:12 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-06-20 11:53:27 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
patch from http://sourceforge.net/tracker/index.php?func=detail&aid=1521274&group_id=22307&atid=374932 (1.55 KB, patch)
2007-05-07 20:42 EDT, ryo fujita
no flags Details | Diff

  None (edit)
Description ryo fujita 2007-05-07 20:42:51 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

#!/usr/bin/env python
# coding:utf-8

import MySQLdb

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

Additional info:
Comment 2 Jiri Pallich 2012-06-20 11:53:27 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.