Bug #41777 can not correctly display Chinese character under mysql client
Submitted: 29 Dec 2008 4:59 Modified: 30 Dec 2008 13:15
Reporter: [ name withheld ] Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:mysql-5.1.30 OS:Microsoft Windows (XP SP2)
Assigned to: CPU Architecture:Any

[29 Dec 2008 4:59] [ name withheld ]
setlocale(LC_CTYPE, "");             /* To get right sortorder */

the above line from my_win_init/my_init.c causes the MS CRT library
function "putc" to intetpret Chinese character errorously.
When i comment out that line and recomplie & link, Chinese character can
be show with no problem. But i am not sure if comment out this line would
cause other problem.

i guess this issue would affect Japanese and Korea as well.

How to repeat:
1) install mysql
2) create some table with GBK encoding and fill it with some Chinese characters
3) open command line client and set names 'gbk'
4) issue some select statement that return Chinese string
[29 Dec 2008 6:11] [ name withheld ]
i digged into the MS CRT a little, and it show up that the problem is caused
by tee_print_sized_data.
tee_print_sized_data call tee_putc, which in turn call putc, which call write
to do the actually write.
but MS did some argument check in write, so if we wrote a single byte of some
mutlibyte character, it writes nothing and return -1.
i think replace tee_putc with tee_puts in tee_print_sized_data would fix the
problem, but may cause some "sizing" problem. :)
[30 Dec 2008 13:15] Miguel Solorzano
Thank you for the bug report. Duplicate of bug: http://bugs.mysql.com/bug.php?id=36279