Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-19748

charset issue using mysql command

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Not a Bug
    • 10.3
    • N/A
    • Protocol

    Description

      mysql command has a charset issue.
      To reproduced :

      CREATE TABLE `t3` (`t` VARCHAR(10)) COLLATE=latin1_swedish_ci ENGINE=InnoDB;
      insert into t3 values (','), ('é'), ('é');
      

      using windows:

      when using mysql.exe : "C:\Program Files\MariaDB 10.3\bin\mysql.exe" --port=3306 --host=192.168.0.45 --default-character-set=utf8"
      (command is "select t, hex(t) from testj.t3")

      exchanges are ok :

      06 00 00 05 02 c3 a9 02 45 39 
      06 00 00 06 02 c3 a9 02 45 39 
      05 00 00 07 01 2c 02 32 43 
      

      but results are :

      +------+--------+
      | t    | hex(t) |
      +------+--------+
      | ÔÇÜ    | 82     |
      | ├®    | E9     |
      | ├®    | E9     |
      

      using latin1 : "C:\Program Files\MariaDB 10.3\bin\mysql.exe" --port=3306 --host=192.168.0.45 --default-character-set=latin1"

      05 00 00 05 01 2c 02 32 43 
      05 00 00 06 01 e9 02 45 39 
      05 00 00 07 01 e9 02 45 39 
      

      2c corresponds to ',' E9 correspond to 'é' ... but the displayed result is:

      +------+--------+
      | t    | hex(t) |
      +------+--------+
      | ,    | 2C     |
      | Ú    | E9     |
      | Ú    | E9     |
      +------+--------+
      

      more problematic : inserts :

      C:\Users\diego>"C:\Program Files\MariaDB 10.3\bin\mysql.exe" --port=3306 --host=192.168.0.45 --default-character-set=latin1
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 77
      Server version: 10.4.5-MariaDB-1:10.4.5+maria~bionic-log mariadb.org binary distribution
       
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
       
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
       
      MariaDB [(none)]> select t, hex(t) from testj.t3;
      +------+--------+
      | t    | hex(t) |
      +------+--------+
      | ,    | 2C     |
      | Ú    | E9     |
      | Ú    | E9     |
      +------+--------+
      3 rows in set (0.045 sec)
       
      MariaDB [(none)]> insert into testj.t3 value ('é');
      Query OK, 1 row affected (0.016 sec)
       
      MariaDB [(none)]> select t, hex(t) from testj.t3;
      +------+--------+
      | t    | hex(t) |
      +------+--------+
      | ,    | 2C     |
      | Ú    | E9     |
      | Ú    | E9     |
      | é    | 82     |
      +------+--------+
      4 rows in set (0.008 sec)
      

      Hexadecimal 82 doesn't correspond here to é, E9 did (http://ascii-table.com/codepage.php?819)

      On ubuntu:

      diego@diego-pc:~$ mysql --port=3306 -udiego --default-character-set=utf8 --host=127.0.0.1
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 84
      Server version: 10.4.5-MariaDB-1:10.4.5+maria~bionic-log mariadb.org binary distribution
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      MariaDB [(none)]> select t, hex(t) from testj.t3;
      +------+--------+
      | t    | hex(t) |
      +------+--------+
      | ,    | 2C     |
      | é    | E9     |
      | é    | E9     |
      +------+--------+
      3 rows in set (0.000 sec)
      

      this one is OK !

      but :

       
      {noformat}
      diego@diego-pc:~$ mysql --port=3306 -udiego --default-character-set=latin1 --host=127.0.0.1
      Welcome to the MariaDB monitor.  Commands end with ; or \g.
      Your MariaDB connection id is 85
      Server version: 10.4.5-MariaDB-1:10.4.5+maria~bionic-log mariadb.org binary distribution
      Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
      Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
      MariaDB [(none)]> select t, hex(t) from testj.t3;
      +------+--------+
      | t    | hex(t) |
      +------+--------+
      | ,    | 2C     |
      | �    | E9     |
      | �    | E9     |
      +------+--------+
      3 rows in set (0.000 sec)
      {noformat}
       
      but protocol is still ok : 
       
      {noformat}
      05 00 00 05 01 2c 02 32 43 
      05 00 00 06 01 e9 02 45 39 
      05 00 00 07 01 e9 02 45 39
      {noformat}
       
      
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            diego dupin Diego Dupin
            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.