Welcome! Log In Create A New Profile

Advanced

[njs] Interactive shell: fixed non-ascii character support.

Dmitry Volyntsev
February 09, 2018 11:20AM
details: http://hg.nginx.org/njs/rev/05605a9f0ad7
branches:
changeset: 437:05605a9f0ad7
user: Dmitry Volyntsev <xeioex@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]
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Interactive shell: fixed non-ascii character support.

Dmitry Volyntsev 373 February 09, 2018 11:20AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 76
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready