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

ruby-changes:39533

From: usa <ko1@a...>
Date: Mon, 17 Aug 2015 17:55:20 +0900 (JST)
Subject: [ruby-changes:39533] usa:r51614 (ruby_2_1): merge revision(s) 51116: [Backport #11324]

usa	2015-08-17 17:55:00 +0900 (Mon, 17 Aug 2015)

  New Revision: 51614

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

  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_1/
  Modified files:
    branches/ruby_2_1/ChangeLog
    branches/ruby_2_1/test/ruby/test_transcode.rb
    branches/ruby_2_1/transcode.c
    branches/ruby_2_1/version.h
Index: ruby_2_1/ChangeLog
===================================================================
--- ruby_2_1/ChangeLog	(revision 51613)
+++ ruby_2_1/ChangeLog	(revision 51614)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1
+Mon Aug 17 17:54:33 2015  Nobuyoshi Nakada  <nobu@r...>
+
+	* transcode.c (rb_econv_set_replacement): target encoding name can
+	  be empty now.  [ruby-core:69841] [Bug #11324]
+
 Mon Aug 17 17:52:11 2015  Nobuyoshi Nakada  <nobu@r...>
 
 	* hash.c (rb_any_hash): fix Float hash.  rb_dbl_hash() returns a
Index: ruby_2_1/version.h
===================================================================
--- ruby_2_1/version.h	(revision 51613)
+++ ruby_2_1/version.h	(revision 51614)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1
 #define RUBY_VERSION "2.1.7"
 #define RUBY_RELEASE_DATE "2015-08-17"
-#define RUBY_PATCHLEVEL 396
+#define RUBY_PATCHLEVEL 397
 
 #define RUBY_RELEASE_YEAR 2015
 #define RUBY_RELEASE_MONTH 8
Index: ruby_2_1/test/ruby/test_transcode.rb
===================================================================
--- ruby_2_1/test/ruby/test_transcode.rb	(revision 51613)
+++ ruby_2_1/test/ruby/test_transcode.rb	(revision 51614)
@@ -2109,4 +2109,13 @@ class TestTranscode < Test::Unit::TestCa https://github.com/ruby/ruby/blob/trunk/ruby_2_1/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_1/transcode.c
===================================================================
--- ruby_2_1/transcode.c	(revision 51613)
+++ ruby_2_1/transcode.c	(revision 51614)
@@ -2201,7 +2201,7 @@ rb_econv_set_replacement(rb_econv_t *ec, https://github.com/ruby/ruby/blob/trunk/ruby_2_1/transcode.c#L2201
 
     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_1
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r51116


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

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