Setting character set at connection fails

Bug #499362 reported by Geert JM Vanderkelen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Connector/Python
Fix Released
High
Geert JM Vanderkelen

Bug Description

The charset connection option is ignored

    db = mysql.connect(user='root',buffered=True,
        charset="latin7")
    cur = db.cursor()

    cur.execute("SHOW VARIABLES LIKE '%%char%%'")
    print_rows(cur.fetchall())

outputs

(u'character_set_client', u'utf8')
(u'character_set_connection', u'utf8')
(u'character_set_database', u'utf8')
(u'character_set_filesystem', u'binary')
(u'character_set_results', u'utf8')
(u'character_set_server', u'utf8')
(u'character_set_system', u'utf8')
(u'character_sets_dir', u'/opt/mysql/mysql-5.1.41-osx10.5-x86_64/share/charsets/')

Should not use SET NAMES when connecting.

Tags: charset

Related branches

Revision history for this message
Geert JM Vanderkelen (geertjmvdk) wrote :

revno: 170
committer: Geert Vanderkelen <email address hidden>
branch nick: myconnpy-CHARSET
timestamp: Tue 2009-12-22 09:37:10 +0100
message:
  Fix setting character set at connection

  * mysql.connector.Connect(charset='latin1') now works as expected
  * Default character set is (still) UTF-8.
  * SET NAMES is only used when changing character set after connecting.
    Use MySQL.set_charset(charsetname) to change.
  * Test case added for bug report; fixing test case in test_protocol.py
    to reflect the new default character set 'utf-8'.

Changed in myconnpy:
status: Confirmed → Fix Committed
Changed in myconnpy:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.