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

ruby-changes:39492

From: nagachika <ko1@a...>
Date: Fri, 14 Aug 2015 16:42:36 +0900 (JST)
Subject: [ruby-changes:39492] nagachika:r51573 (ruby_2_2): merge revision(s) 51116: [Backport #11324]

nagachika	2015-08-14 16:42:08 +0900 (Fri, 14 Aug 2015)

  New Revision: 51573

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

  Log:
    merge revision(s) 51116: [Backport #11324]
    
    * transcode.c (rb_econv_set_replacement): target encoding name can
      be empty now.  [ruby-core:69841] [Bug #11324]

  Modified directories:
    branches/ruby_2_2/
  Modified files:
    branches/ruby_2_2/ChangeLog
    branches/ruby_2_2/test/ruby/test_transcode.rb
    branches/ruby_2_2/transcode.c
    branches/ruby_2_2/version.h
Index: ruby_2_2/ChangeLog
===================================================================
--- ruby_2_2/ChangeLog	(revision 51572)
+++ ruby_2_2/ChangeLog	(revision 51573)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1
+Fri Aug 14 16:30:43 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* transcode.c (rb_econv_set_replacement): target encoding name can
+	  be empty now.  [ruby-core:69841] [Bug #11324]
+
 Fri Aug 14 15:24:12 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* hash.c (rb_any_hash): fix Float hash.  rb_dbl_hash() returns a
Index: ruby_2_2/version.h
===================================================================
--- ruby_2_2/version.h	(revision 51572)
+++ ruby_2_2/version.h	(revision 51573)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1
 #define RUBY_VERSION "2.2.3"
 #define RUBY_RELEASE_DATE "2015-08-14"
-#define RUBY_PATCHLEVEL 166
+#define RUBY_PATCHLEVEL 167
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_2/test/ruby/test_transcode.rb
===================================================================
--- ruby_2_2/test/ruby/test_transcode.rb	(revision 51572)
+++ ruby_2_2/test/ruby/test_transcode.rb	(revision 51573)
@@ -2109,4 +2109,13 @@ class TestTranscode < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_transcode.rb#L2109
       assert_equal([expected]*num, result, bug11277)
     end;
   end
+
+  def test_universal_newline
+    bug11324 = '[ruby-core:69841] [Bug #11324]'
+    usascii = Encoding::US_ASCII
+    s = "A\nB\r\nC".force_encoding(usascii)
+    assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true), bug11324)
+    assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true, undef: :replace), bug11324)
+    assert_equal("A\nB\nC", s.encode(usascii, universal_newline: true, undef: :replace, replace: ''), bug11324)
+  end
 end
Index: ruby_2_2/transcode.c
===================================================================
--- ruby_2_2/transcode.c	(revision 51572)
+++ ruby_2_2/transcode.c	(revision 51573)
@@ -2199,7 +2199,7 @@ rb_econv_set_replacement(rb_econv_t *ec, https://github.com/ruby/ruby/blob/trunk/ruby_2_2/transcode.c#L2199
 
     encname2 = rb_econv_encoding_to_insert_output(ec);
 
-    if (encoding_equal(encname, encname2)) {
+    if (!*encname2 || encoding_equal(encname, encname2)) {
         str2 = xmalloc(len);
         MEMCPY(str2, str, unsigned char, len); /* xxx: str may be invalid */
         len2 = len;

Property changes on: ruby_2_2
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51116


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

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