Bug #102806 Linux client does not accept umlauts if started with default-character-set=utf8
Submitted: 3 Mar 22:16 Modified: 5 Mar 13:59
Reporter: Björn Voigt (OCA) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:8.0.23 OS:Linux
Assigned to: CPU Architecture:Any
Tags: character set, client, Unicode, utf8

[3 Mar 22:16] Björn Voigt
Description:
If the MySQL client is started with the option --default-character-set=utf8 (or e.g. --default-character-set=utf8mb4) it becomes impossible to enter 8bit characters (e.g. German umlauts like ä,ö,ü). Scripts (e.g. cat script.sql | mysql ...) work as expected, but interactive input is impossible.

MySQL 8.0.23 and MySQL 5.7.33 are affected. All MySQL builds (e.g. mysql-5.7.33-linux-glibc2.12-x86_64 from mysql.com) show this bug.

MySQL Windows builds and MariaDB (tested with 10.4.17 on openSUSE 15.2) do not show this bug on the same computer.

How to repeat:
Start MySQL client with the option --default-character-set=utf8 (or utf8mb4). The option "default-character-set=utf8" can also be placed in $HOME/.my.cnf:

# mysql --default-character-set=utf8 -u root --host 127.0.0.1 -p

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1305
Server version: 8.0.23 MySQL Community Server - GPL
Enter password:
Copyright (c) 2000, 2021, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

You are enforcing ssl connection via unix socket. Please consider
switching ssl off as it does not make connection via unix socket
any more secure.
mysql> äöü <<-- this umlauts can not be typed

Different locale configurations were tested. Here I use:

# locale
LANG=POSIX
LC_CTYPE=de_DE.UTF-8
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

Suggested fix:
There is probably something wrong with libedit.
[3 Mar 22:55] MySQL Verification Team
Thank you for the bug report. Others kind of accented letters can't be typed too on Linux.
[5 Mar 10:08] Erlend Dahl
Posted by developer:
 
As reported, it doesn't work on 8.0.23. In 8.0.24, the editline library has been upgraded, and I can make it work on Linux:

mysql -h127.0.0.1 --port=13000 -p -uroot --default-character-set=utf8mb4

mysql> select version();
+--------------+
| version()    |
+--------------+
| 8.0.24-debug |
+--------------+
1 row in set (0.01 sec)

mysql> select "Ça, c'est Noël";
+------------------+
| Ça, c'est Noël   |
+------------------+
| Ça, c'est Noël   |
+------------------+
1 row in set (0.00 sec)

mysql>
[5 Mar 13:59] Paul DuBois
Posted by developer:
 
Fixed in 8.0.24.

For builds compiled using the libedit library, if the mysql client
was invoked with the --default-character-set=utf8 option, libedit
rejected input of multibyte characters.