Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-342

Don't allow changing the default connection character set

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 2.0.0-rc
    • 2.0.1
    • Generic
    • None
    • 3.13

    Description

      In Version 1.0 and 1.1 MariaDB Connector/Python raised an exception if the character set for connection changed to non utf8mb4 which might end up in corrupted data.

      Example:

      import mariadb
       
      conn=mariadb.connect(user="georg", db="test")
      cursor=conn.cursor()
      cursor.execute("CREATE OR REPLACE TABLE t1 (a varchar(100) charset latin1)");
      b='\xc3\x28'
      cursor.execute("insert into t1 values (?)", (b,))
      cursor.execute("select * from t1")
      row= cursor.fetchone()
      print(row)
      cursor.execute("set names latin1")
      cursor.execute("select * from t1")
      row= cursor.fetchone()
      print(row)
      

      Output:

      ('Ã(',)
      ('(',)
      

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.