Uploaded image for project: 'MariaDB Connector/ODBC'
  1. MariaDB Connector/ODBC
  2. ODBC-437

Latest ODBC driver returns NUL characters in strings with accents (!)

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 3.2.3
    • 3.2.4
    • General
    • None
    • Windows

    Description

      When using MariaDB ODBC connector 3.2.3, strings values are returned with apparently random NUL characters (i.e. '\0').

      This issue occurs when string contains accents (french accents : éèàç etc...). There is no problem with older drivers :

      • MariaDB ODBC 3.1.19 Driver works fine
      • MySQL ODBC 5.1.8 Driver works fine

      I attached a sample JSCRIPT to reproduce the bug : run it with CSCRIPT.EXE on a Windows host:

      SET MYSQL_PASSWORD=[ROOT_PASSWORD]
      CSCRIPT.EXE mariadb_nul_char_bug.js >mariadb_nul_char_bug.log
      

      You need to redirect the script output to a log file in order to see the string difference (NUL characters are not displayed in a Windows terminal).

      The test script usually appends NUL characters at the end of string, but in our real application we got NUL characters randomly within strings (not always trailing NUL characters).

      E.

      Attachments

        Activity

          Thank you for the report and for the script in particular. That was a regression, and I was surprised it wasn't covered with any testcase
          The problem was that If the field value contained characters represented in utf8mb4(or other selected connection charset, but default in case of unicode part of ODBC API is used is utf8mb4) with more than 1 byte, the driver would return wrong length.

          Lawrin Lawrin Novitsky added a comment - Thank you for the report and for the script in particular. That was a regression, and I was surprised it wasn't covered with any testcase The problem was that If the field value contained characters represented in utf8mb4(or other selected connection charset, but default in case of unicode part of ODBC API is used is utf8mb4) with more than 1 byte, the driver would return wrong length.
          LeJusteWeb Alex F added a comment - - edited

          I confirm this is a major issue I encountered too.
          I recently switched from ODBC Connector 3.1.20 to 3.2.3 to use data in ASP websites, then I was forced to revert to the 3.1.20 version almost instantly!

          • Database server is MariaDB 10.11.8 engine, on Windows Server 2019.
          • Tables are InnoDB.
          • Charset is "utf8mb4" with Collation "utf8mb4_unicode_ci".

          The MariaDB ODBC Connector 3.1.20 fully handles accented characters, both in writing to DB as reading from it as well.
          But reading was screwed up starting from version 3.2 of the ODBC Connector.

          French accented characters eg.

          é à û ï
          

          They seems to be read with additional null "bytes" or "data". This affects both UPPERCASE and lowercase accented characters.
          This leads to be completely breaking the program logic. In my case, webpages are completely messed-up.

          Correctly rendered with 3.1.20 :

          <a target="_blank" href="https://www.ecole-tunon.com" alt="AC Prévention" title="AC Prévention" class="grow-105 nodeco"><img src="image.jpg" class="thumbnail fullwidth maB075" title="AC Prévention" alt="AC Prévention"></a>
          

          Screwed-up render with 3.2.3 :

          <a target="_blank" href="https://www.ecole-tunon.com" alt="AC Prévention<img src="image.jpg" class="thumbnail fullwidth maB075" title="AC Prévention" alt="AC Prévention"></a>
          

          LeJusteWeb Alex F added a comment - - edited I confirm this is a major issue I encountered too. I recently switched from ODBC Connector 3.1.20 to 3.2.3 to use data in ASP websites, then I was forced to revert to the 3.1.20 version almost instantly! Database server is MariaDB 10.11.8 engine, on Windows Server 2019. Tables are InnoDB . Charset is " utf8mb4 " with Collation " utf8mb4_unicode_ci ". The MariaDB ODBC Connector 3.1.20 fully handles accented characters , both in writing to DB as reading from it as well. But reading was screwed up starting from version 3.2 of the ODBC Connector. French accented characters eg. é à û ï They seems to be read with additional null "bytes" or "data". This affects both UPPERCASE and lowercase accented characters. This leads to be completely breaking the program logic. In my case, webpages are completely messed-up. Correctly rendered with 3.1.20 : < a target = "_blank" href = "https://www.ecole-tunon.com" alt = "AC Prévention" title = "AC Prévention" class = "grow-105 nodeco" >< img src = "image.jpg" class = "thumbnail fullwidth maB075" title = "AC Prévention" alt = "AC Prévention" ></ a > Screwed-up render with 3.2.3 : < a target = "_blank" href = "https://www.ecole-tunon.com" alt = "AC Prévention<img src=" image.jpg" class = "thumbnail fullwidth maB075" title = "AC Prévention" alt = "AC Prévention" ></ a >

          People

            Lawrin Lawrin Novitsky
            edot06 Emmanuel KARTMANN
            Votes:
            0 Vote for this issue
            Watchers:
            3 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.