[njs] Interactive shell: fixed non-ascii character support.
Dmitry Volyntsev
xeioex at nginx.com
Fri Feb 9 16:17:49 UTC 2018
details: http://hg.nginx.org/njs/rev/05605a9f0ad7
branches:
changeset: 437:05605a9f0ad7
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Fri Feb 09 19:16:19 2018 +0300
description:
Interactive shell: fixed non-ascii character support.
diffstat:
njs/njs.c | 3 +++
njs/test/njs_expect_test.exp | 8 ++++++++
2 files changed, 11 insertions(+), 0 deletions(-)
diffs (38 lines):
diff -r 624f79e326d5 -r 05605a9f0ad7 njs/njs.c
--- a/njs/njs.c Fri Feb 09 19:16:18 2018 +0300
+++ b/njs/njs.c Fri Feb 09 19:16:19 2018 +0300
@@ -11,6 +11,7 @@
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
+#include <locale.h>
#include <nxt_auto_config.h>
#include <nxt_types.h>
@@ -459,6 +460,8 @@ njs_editline_init(njs_vm_t *vm)
rl_attempted_completion_function = njs_completion_handler;
rl_basic_word_break_characters = (char *) " \t\n\"\\'`@$><=;,|&{(";
+ setlocale(LC_ALL, "");
+
njs_completion.completions = njs_vm_completions(vm, NULL);
if (njs_completion.completions == NULL) {
return NXT_ERROR;
diff -r 624f79e326d5 -r 05605a9f0ad7 njs/test/njs_expect_test.exp
--- a/njs/test/njs_expect_test.exp Fri Feb 09 19:16:18 2018 +0300
+++ b/njs/test/njs_expect_test.exp Fri Feb 09 19:16:19 2018 +0300
@@ -182,6 +182,14 @@ njs_test {
"JSON.parse(Error()\r\nSyntaxError: Unexpected token \"\" in 1"}
}
+# Non-ASCII characters
+njs_test {
+ {"'絵文字'\r\n"
+ "絵文字"}
+ {"var v = 'абвгдеёжзийкл';v[10]\r\n"
+ "й"}
+}
+
# require('fs')
set file [open njs_test_file w]
More information about the nginx-devel
mailing list