Bug #3453 MySQL output formatting in multibyte character sets
Submitted: 13 Apr 2004 4:39 Modified: 9 Sep 2004 13:33
Reporter: Alexander Barkov Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:Any (all)
Assigned to: Alexander Barkov CPU Architecture:Any

[13 Apr 2004 4:39] Alexander Barkov
Description:
If the current charset is multibyte, result table won't look so pretty,
because, apparently, mysql uses column length in *bytes* to determine
column widths.

How to repeat:
1. Start mysql in a terminal supporting multibyte charsets.
gnome-terminal is fine. 
2. Switch it into utf-8 or SJIS or EUC-JP mode.
3. Start mysql, Run "SET NAMES utf8/sjis/ujis"
4. SELECT some multibyte characters, for example:

mysql> select _ucs2 0x9990,_ucs2 0x9991, _ucs2 0x9993;

The table will look broken:
+-----+-----+-----+
|     |     |     |
+-----+-----+-----+
| x | y | z |
+-----+-----+-----+
A well formed table should look like:

+---+---+---+
|   |   |   |
+---+---+---+
| x | y | z |
+---+---+---+
[13 Apr 2004 4:41] Alexander Barkov
See a screenshot example in the "File" section of this report.
[16 Jun 2004 9:48] Alexander Barkov
Gnome terminal in UJIS mode

Attachment: gnome-ujis.png (image/png, text), 27.82 KiB.

[16 Jun 2004 9:48] Alexander Barkov
KDE terminal in UJIS mode

Attachment: konsole-ujis.png (image/png, text), 14.19 KiB.

[16 Jun 2004 9:57] Alexander Barkov
KTERM in UJIS mode

Attachment: kterm-ujis.png (image/png, text), 7.19 KiB.

[16 Jun 2004 10:29] Alexander Barkov
GNOME terminal in UTF8 mode

Attachment: gnome-utf8.png (image/png, text), 28.16 KiB.

[16 Jun 2004 10:32] Alexander Barkov
KDE terminal in UTF8 mode

Attachment: konsole-utf8.png (image/png, text), 14.18 KiB.

[16 Jun 2004 10:56] Alexander Barkov
Related Unicode pages:
http://www.unicode.org/reports/tr11/index.html
http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
[25 Aug 2004 10:55] Alexander Barkov
I fix has been pushed. I'm waiting for Shuichi and Alfredo to check if it works fine.
[9 Sep 2004 13:33] Alexander Barkov
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html
[8 Apr 2012 7:24] Nikolay (unDEFER) Krivchenkov
7 years has gone, but I yet see this bug in 5.0 and 5.1 release. It wasn't fixed?
[8 Apr 2012 7:37] Nikolay (unDEFER) Krivchenkov
OK. I have found how to call mysql to get good output http://bugs.mysql.com/bug.php?id=7616
But I really can't understand why mysql can't to take into account the locale charset by default.. Very-very-very many problems would go away for begining users if it will so.