diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ext/readline/readline.c | 2 | ||||
-rw-r--r-- | test/readline/test_readline.rb | 2 |
3 files changed, 9 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Mon Sep 6 10:31:59 2010 NARUSE, Yui <naruse@ruby-lang.org> + + * ext/readline/readline.c (readline_s_get_line_buffer): + Readline.line_buffer should return locale string. + [ruby-dev:42184] #3791 + Mon Sep 6 09:47:24 2010 NARUSE, Yui <naruse@ruby-lang.org> * util.c (ruby_strtod): check there is at least 1 digit after diff --git a/ext/readline/readline.c b/ext/readline/readline.c index b654fa099b..ac88c84f59 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -426,7 +426,7 @@ readline_s_get_line_buffer(VALUE self) rb_secure(4); if (rl_line_buffer == NULL) return Qnil; - return rb_tainted_str_new2(rl_line_buffer); + return rb_locale_str_new_cstr(rl_line_buffer); } #else #define readline_s_get_line_buffer rb_f_notimplement diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index 5871f4c2bb..fc1e719462 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -153,6 +153,8 @@ class TestReadline < Test::Unit::TestCase assert_equal("first second", actual_line_buffer) assert_equal(12, actual_point) assert_equal("first complete finish", Readline.line_buffer) + assert_equal(Encoding.find("locale"), Readline.line_buffer.encoding) + assert_equal(true, Readline.line_buffer.tainted?) assert_equal(21, Readline.point) ensure stdin.close(true) |