From 5804bb4ef0acd7ac42e628c2d8c404957dc86cf9 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 17 Jun 2019 09:56:00 +0100 Subject: MDEV-19750 mysql command wrong encoding Restore the detection of default charset in command line utilities. It worked up to 10.1, but was broken by Connector/C. Moved code for detection of default charset from sql-common/client.c to mysys, and make command line utilities to use this code if charset was not specified on the command line. --- client/mysql.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'client/mysql.cc') diff --git a/client/mysql.cc b/client/mysql.cc index 06bf31e16ce..2247e93ca93 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -40,6 +40,7 @@ #include "my_readline.h" #include #include +#include #if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H) #include @@ -4701,7 +4702,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, select_limit,max_join_size); mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command); } - + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (!do_connect(&mysql, host, user, password, database, -- cgit v1.2.1