Bug #7616 mysql client display problem with UTF8

Submitted: 2 Jan 2005 11:50 Modified: 11 Jan 2005 15:20
Reporter: Thomas Zehetbauer Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:4.1.8 OS:Linux (Linux/Fedora Core 3)
Assigned to: Alexander Barkov CPU Architecture:Any

[2 Jan 2005 11:50] Thomas Zehetbauer
Description:
mysql client seemingly uses the byte length to calculate the column width, with UTF8 this causes columns to get shortened for every umlaut.

How to repeat:
 create table test (a text);
insert into test values ('aaa');
insert into test values ('aaä');
insert into test values ('aää');
insert into test values ('äää');
select * from test;

+--------+
| a      |
+--------+
| aaa    |
| aaä   |
| aää  |
| äää |
+--------+
[2 Jan 2005 16:37] MySQL Verification Team
I tested on Slackware with BK source and looks it is terminal issue
at your side:

mysql>  create table test (a text);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into test values ('aaa');
Query OK, 1 row affected (0.01 sec)

mysql> insert into test values ('aaä');
Query OK, 1 row affected (0.00 sec)

mysql> insert into test values ('aää');
Query OK, 1 row affected (0.00 sec)

mysql> insert into test values ('äää');
Query OK, 1 row affected (0.00 sec)

mysql> select * from test;
+------+
| a    |
+------+
| aaa  |
| aaä  |
| aää  |
| äää  |
+------+
4 rows in set (0.00 sec)

mysql> select version();
+-----------------+
| version()       |
+-----------------+
| 4.1.9-debug-log |
+-----------------+
1 row in set (0.04 sec)

mysql> 

Please verify if you get warnings in the offended inserts and
do: show warnings.

Thanks in advance.
[5 Jan 2005 10:38] Thomas Zehetbauer
Here is the hexadecimal dump of the output:

0000000: 2b2d 2d2d 2d2d 2d2d 2d2b 0a7c 2061 2020  +--------+.| a
0000010: 2020 2020 7c0a 2b2d 2d2d 2d2d 2d2d 2d2b      |.+--------+
0000020: 0a7c 2061 6161 2020 2020 7c0a 7c20 6161  .| aaa    |.| aa
0000030: c3a4 2020 207c 0a7c 2061 c3a4 c3a4 2020  ..   |.| a....
0000040: 7c0a 7c20 c3a4 c3a4 c3a4 207c 0a2b 2d2d  |.| ...... |.+--
0000050: 2d2d 2d2d 2d2d 2b0a                      ------+.

Note that 61 is normal 'a' and c3 a4 is umlaut a which are both only one character.
[6 Jan 2005 12:27] Aleksey Kishkin
I got the same output in case of UTF8 terminal. Slackware by default uses 8-bit terminal.
[11 Jan 2005 15:20] Alexander Barkov
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

Additional info:

You need to run mysql with --default-character-set=utf8 in order to get 
a nice looking output:

$mysql --default-character-set=utf8 test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 6 to server version: 4.1.9-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> select * from test;
+--------+
| a      |
+--------+
| aaa    |
| aaä    |
| aää    |
| äää    |
+--------+
4 rows in set (0.00 sec)

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.039 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.