ruby-changes:11694
From: yugui <ko1@a...>
Date: Mon, 4 May 2009 21:31:00 +0900 (JST)
Subject: [ruby-changes:11694] Ruby:r23333 (ruby_1_9_1): merges r23159 from trunk into ruby_1_9_1.
yugui 2009-05-04 21:29:55 +0900 (Mon, 04 May 2009) New Revision: 23333 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23333 Log: merges r23159 from trunk into ruby_1_9_1. -- * string.c (rb_str_rstrip_bang): should not sign-expand non-ascii. [ruby-core:23158] Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/string.c branches/ruby_1_9_1/test/ruby/test_string.rb Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 23332) +++ ruby_1_9_1/ChangeLog (revision 23333) @@ -1,3 +1,8 @@ +Wed Apr 8 20:08:16 2009 Nobuyoshi Nakada <nobu@r...> + + * string.c (rb_str_rstrip_bang): should not sign-expand non-ascii. + [ruby-core:23158] + Wed Apr 8 17:29:29 2009 NARUSE, Yui <naruse@r...> * string.c (rb_str_chop_bang): reset coderange. [ruby-core:23155] Index: ruby_1_9_1/string.c =================================================================== --- ruby_1_9_1/string.c (revision 23332) +++ ruby_1_9_1/string.c (revision 23333) @@ -6070,7 +6070,8 @@ /* remove trailing spaces or '\0's */ if (single_byte_optimizable(str)) { - while (s < t && (*(t-1) == '\0' || rb_enc_isspace(*(t-1), enc))) t--; + unsigned char c; + while (s < t && ((c = *(t-1)) == '\0' || rb_enc_isspace(c, enc))) t--; } else { char *tp; Index: ruby_1_9_1/test/ruby/test_string.rb =================================================================== --- ruby_1_9_1/test/ruby/test_string.rb (revision 23332) +++ ruby_1_9_1/test/ruby/test_string.rb (revision 23333) @@ -1139,6 +1139,8 @@ def test_strip assert_equal(S("x"), S(" x ").strip) assert_equal(S("x"), S(" \n\r\t x \t\r\n\n ").strip) + assert_equal(S(""), S("\xa0".force_encoding("iso-8859-1")).strip) + assert_equal(S("a"), S("a\xa0".force_encoding("iso-8859-1")).strip) end def test_strip! -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/