[前][次][番号順一覧][スレッド一覧]

ruby-changes:11142

From: yugui <ko1@a...>
Date: Wed, 4 Mar 2009 18:19:23 +0900 (JST)
Subject: [ruby-changes:11142] Ruby:r22745 (ruby_1_9_1): merges r22611 from trunk into ruby_1_9_1.

yugui	2009-03-04 18:19:09 +0900 (Wed, 04 Mar 2009)

  New Revision: 22745

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22745

  Log:
    merges r22611 from trunk into ruby_1_9_1.
    --
    * string.c (rb_str_force_encoding): should clear coderange at changing
      encoding.  [ruby-core:22437]

  Modified files:
    branches/ruby_1_9_1/ChangeLog
    branches/ruby_1_9_1/string.c
    branches/ruby_1_9_1/test/ruby/test_m17n.rb

Index: ruby_1_9_1/ChangeLog
===================================================================
--- ruby_1_9_1/ChangeLog	(revision 22744)
+++ ruby_1_9_1/ChangeLog	(revision 22745)
@@ -1,3 +1,8 @@
+Wed Feb 25 12:27:59 2009  Nobuyoshi Nakada  <nobu@r...>
+
+	* string.c (rb_str_force_encoding): should clear coderange at changing
+	  encoding.  [ruby-core:22437]
+
 Wed Feb 25 12:06:09 2009    <nobu@r...>
 
 	* io.c (rb_io_getline_1): enables limit even if rs is given.
Index: ruby_1_9_1/string.c
===================================================================
--- ruby_1_9_1/string.c	(revision 22744)
+++ ruby_1_9_1/string.c	(revision 22745)
@@ -6780,6 +6780,7 @@
 {
     str_modifiable(str);
     rb_enc_associate(str, rb_to_encoding(enc));
+    ENC_CODERANGE_CLEAR(str);
     return str;
 }
 
Index: ruby_1_9_1/test/ruby/test_m17n.rb
===================================================================
--- ruby_1_9_1/test/ruby/test_m17n.rb	(revision 22744)
+++ ruby_1_9_1/test/ruby/test_m17n.rb	(revision 22745)
@@ -1107,10 +1107,10 @@
   end
 
   def test_symbol_op
-    ops = %w[
+    ops = %w"
       .. ... + - +(binary) -(binary) * / % ** +@ -@ | ^ & ! <=> > >= < <= ==
       === != =~ !~ ~ ! [] []= << >> :: `
-    ] #`
+    "
     ops.each do |op|
       assert_equal(Encoding::US_ASCII, op.intern.encoding, "[ruby-dev:33449]")
     end
@@ -1164,7 +1164,7 @@
   end
 
   def test_bignum_to_s
-    assert_equal(Encoding::US_ASCII, (1<<129).to_s.encoding)
+    assert_equal(Encoding::US_ASCII, (1 << 129).to_s.encoding)
   end
 
   def test_array_to_s
@@ -1306,6 +1306,10 @@
   def test_force_encoding
     assert(("".center(1, "\x80".force_encoding("utf-8")); true),
            "moved from btest/knownbug, [ruby-dev:33807]")
+    a = "".force_encoding("ascii-8bit") << 0xC3 << 0xB6
+    assert_equal(1, a.force_encoding("utf-8").size, '[ruby-core:22437]')
+    b = "".force_encoding("ascii-8bit") << 0xC3.chr << 0xB6.chr
+    assert_equal(1, b.force_encoding("utf-8").size, '[ruby-core:22437]')
   end
 
   def test_combchar_codepoint

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]