Description:
This will be difficult to see if you aren't in a fixed pitch font, but the mysql command line client doesn't align multibyte utf8 characters correctly in tabular result sets. The code which pads out the columns appears to count bytes, not characters. The result is that the vertical bars '|' are not drawn in the correct places.
How to repeat:
This should be done from a utf8 terminal.
set names 'utf8';
drop table if exists `t`;
CREATE TABLE `t` (
`c` varchar(20) default NULL
) TYPE=MyISAM DEFAULT CHARSET=utf8;
insert into `t` values ('fübar');
insert into `t` values ('fubar');
mysql-4.1.3> select LENGTH(c), CHAR_LENGTH(c), c from t;
+-----------+----------------+--------+
| LENGTH(c) | CHAR_LENGTH(c) | c |
+-----------+----------------+--------+
| 6 | 5 | fübar |
| 5 | 5 | fubar |
+-----------+----------------+--------+
Suggested fix:
When computing the number of spaces to draw after the column data, characters, not bytes, should be counted.
Description: This will be difficult to see if you aren't in a fixed pitch font, but the mysql command line client doesn't align multibyte utf8 characters correctly in tabular result sets. The code which pads out the columns appears to count bytes, not characters. The result is that the vertical bars '|' are not drawn in the correct places. How to repeat: This should be done from a utf8 terminal. set names 'utf8'; drop table if exists `t`; CREATE TABLE `t` ( `c` varchar(20) default NULL ) TYPE=MyISAM DEFAULT CHARSET=utf8; insert into `t` values ('fübar'); insert into `t` values ('fubar'); mysql-4.1.3> select LENGTH(c), CHAR_LENGTH(c), c from t; +-----------+----------------+--------+ | LENGTH(c) | CHAR_LENGTH(c) | c | +-----------+----------------+--------+ | 6 | 5 | fübar | | 5 | 5 | fubar | +-----------+----------------+--------+ Suggested fix: When computing the number of spaces to draw after the column data, characters, not bytes, should be counted.