summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-07-10 19:28:06 +0200
committerSergei Golubchik <serg@mariadb.org>2022-07-10 22:37:13 +0200
commit7598ef4b2616c476ea38362a3f41c399c4bf530e (patch)
tree046374e3c876c81bec221f027ebea22030754067
parent0e9a255ec87add182f40d4c67d75e67827c0c3ec (diff)
downloadmariadb-git-7598ef4b2616c476ea38362a3f41c399c4bf530e.tar.gz
MDEV-28197 Linux mariadb-client build does not accept Unicode characters
Apparently newer libedit is readline-compatible enough to be detected as a readline, with USE_NEW_READLINE_INTERFACE defined and USE_LIBEDIT_INTERFACE not defined. Let's set the locale unconditionally, independently from the readline/libedit variant. It's already happening anyway now, unless one specifies --default-character-set explicitly.
-rw-r--r--client/mysql.cc8
1 files changed, 4 insertions, 4 deletions
diff --git a/client/mysql.cc b/client/mysql.cc
index 28311defc81..d429a014194 100644
--- a/client/mysql.cc
+++ b/client/mysql.cc
@@ -42,7 +42,7 @@
#include <violite.h>
#include <my_sys.h>
#include <source_revision.h>
-#if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H)
+#if defined(HAVE_LOCALE_H)
#include <locale.h>
#endif
@@ -2684,6 +2684,9 @@ static void initialize_readline ()
/* Allow conditional parsing of the ~/.inputrc file. */
rl_readline_name= (char *) "mysql";
rl_terminal_name= getenv("TERM");
+#ifdef HAVE_SETLOCALE
+ setlocale(LC_ALL,"");
+#endif
/* Tell the completer that we want a crack first. */
#if defined(USE_NEW_READLINE_INTERFACE)
@@ -2692,9 +2695,6 @@ static void initialize_readline ()
rl_add_defun("magic-space", (rl_command_func_t *)&fake_magic_space, -1);
#elif defined(USE_LIBEDIT_INTERFACE)
-#ifdef HAVE_LOCALE_H
- setlocale(LC_ALL,""); /* so as libedit use isprint */
-#endif
rl_attempted_completion_function= (CPPFunction*)&new_mysql_completion;
rl_completion_entry_function= &no_completion;
rl_add_defun("magic-space", (Function*)&fake_magic_space, -1);