[MDEV-19748] charset issue using mysql command Created: 2019-06-13  Updated: 2019-06-13  Resolved: 2019-06-13

Status: Closed
Project: MariaDB Server
Component/s: Protocol
Affects Version/s: 10.3
Fix Version/s: N/A

Type: Bug Priority: Critical
Reporter: Diego Dupin Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: 28458


 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}
 



 Comments   
Comment by Diego Dupin [ 2019-06-13 ]

closing, since bad explanation. issue is elsewhere

Generated at Thu Feb 08 08:54:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.