|
From: Yuriy K. <yu...@ma...> - 2012-03-10 18:15:42
|
Hello!
libedit initialize its allowed character map (over 7bit ascii range) based on
locale/LC_CTYPE (and consider 8bit characters Meta-<7bit-char> otherwise); as
using_history() calls rl_initialize() before gnuplot set process locale, it
results with problems with non-ascii character input. Either init_locale() call
should be moved up, or using_history() moved down, or libedit should be
re-initialized after locale set. Patch for latter below.
(BTW, I noticed that `setlocale(LC_CTYPE,"")` is also called in
set.c/set_encoding/"locale"); is not this redundant after -r1.41? maybe it
should be replaced with `setlocale(LC_CTYPE, NULL)`?)
Index: gnuplot_4.6.0~20120302/src/variable.c
===================================================================
--- gnuplot_4.6.0~20120302.orig/src/variable.c
+++ gnuplot_4.6.0~20120302/src/variable.c
@@ -45,6 +45,7 @@ static char *RCSid() { return RCSid("$Id
#include "plot.h"
#include "util.h"
#include "term_api.h"
+#include "readline.h"
#define PATHSEP_TO_NUL(arg) \
do { \
@@ -571,6 +572,11 @@ locale_handler(int action, char *newloca
#ifdef HAVE_LOCALE_H
setlocale(LC_TIME, "");
setlocale(LC_CTYPE, "");
+#if defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDITLINE)
+ /* we must (re-)initialize readline after locale set */
+ if (interactive)
+ rl_initialize();
+#endif
current_locale = gp_strdup(setlocale(LC_TIME,NULL));
#else
current_locale = gp_strdup(INITIAL_LOCALE);
|