Bug #33006 mysql client: editing non-ascii characters fails
Submitted: 5 Dec 2007 17:40 Modified: 6 Dec 2007 11:26
Reporter: Peter Gulutzan Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.0, 5.1, 6.0 OS:Linux (SUSE 10 64-bit, FreeBSD 7.0 64-bit)
Assigned to: CPU Architecture:Any

[5 Dec 2007 17:40] Peter Gulutzan
Description:
I use the mysql client and MySQL 6.0 source download.
I have SUSE 10.0, which supports UTF-8 by default.
I enter non-ASCII characters, for example
A WITH DIAERESIS ('Ä') on the mysql command line.
Then I try to edit the contents of the line.
I get results that I did not expect.

With MySQL 5.1, I see no similar problem.
I speculate that the difficulty is due to
the recent introduction of new character sets
(WL#1213).

How to repeat:
I use SUSE 10.0, default character set is utf8.
On my keyboard, the setting is 'Ins', that is,
when I type in new characters I don't overwrite
old characters.

I start a session with mysql client thus:

"

pgulutzan@linux:~> /usr/local/mysql/bin/mysql --user=root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 6.0.4-alpha-debug Source distribution

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

mysql> SET NAMES utf8; /* SET NAMES utf8mb3 makes no difference. */
Query OK, 0 rows affected (0.00 sec)

mysql> SHOW VARIABLES like 'char%';
+--------------------------+----------------------------------------+
| Variable_name            | Value                                  |
+--------------------------+----------------------------------------+
| character_set_client     | utf8                                   |
| character_set_connection | utf8                                   |
| character_set_database   | latin1                                 |
| character_set_filesystem | binary                                 |
| character_set_results    | utf8                                   |
| character_set_server     | latin1                                 |
| character_set_system     | utf8                                   |
| character_sets_dir       | /usr/local/mysql/share/mysql/charsets/ |
+--------------------------+----------------------------------------+
8 rows in set (0.00 sec)

"

On the mysql command line, I enter these three characters:
ÄÄÄ
(I use cut-and-paste to enter.)
I don't type <enter> yet. My screen now looks like this

mysql> ÄÄÄ

And my cursor is just after the ÄÄÄ.

Now, either using the non-destructive cursor-back key,
I position the cursor between the first and second Ä.
I type the space key. My screen now looks like this:

mysql> Ä ÄÄ

Now, using the cursor-forward key,
I position the cursor between the second and third Ä.
I type the space key. My screen now looks like this:

mysql> Ä Ä

That doesn't look right. I expected it to look like this:

mysql> Ä Ä Ä

I can see other situations that don't look right, by using
other editing keys, and by pressing the 'up-cursor' to
copy the last statement. Things go wrong regularly when
there are non-ASCII characters.

This did not happen with version 5.1. I suspect that the
recent changes for 4-byte-UTF-8 characters have affected
the client.
[6 Dec 2007 9:32] Susanne Ebrecht
Thank you for writing a bug report.
[6 Dec 2007 11:26] Susanne Ebrecht
Verified as described with using FreeBSD 7.0 64-bit and Gnome Terminal.
[19 Aug 2008 11:29] Susanne Ebrecht
I can reproduce this today with bzr trees for 5.0, 5.1 and 6.0.
[15 Sep 2009 13:30] Peter Gulutzan
Bug#46310 "mysql not handling <BACKSPACE> properly with multi-byte chars",
which is a duplicate of this bug, is being looked at.