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

ruby-changes:41461

From: naruse <ko1@a...>
Date: Thu, 14 Jan 2016 20:19:58 +0900 (JST)
Subject: [ruby-changes:41461] naruse:r53535 (trunk): * lib/uri/generic.rb (URI::Generic#to_s): change encoding to

naruse	2016-01-14 20:20:24 +0900 (Thu, 14 Jan 2016)

  New Revision: 53535

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

  Log:
    * lib/uri/generic.rb (URI::Generic#to_s): change encoding to
      UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@g...>
      https://github.com/ruby/ruby/pull/1188 fix GH-1188

  Modified files:
    trunk/ChangeLog
    trunk/lib/uri/generic.rb
    trunk/test/uri/test_generic.rb
Index: lib/uri/generic.rb
===================================================================
--- lib/uri/generic.rb	(revision 53534)
+++ lib/uri/generic.rb	(revision 53535)
@@ -1341,7 +1341,7 @@ module URI https://github.com/ruby/ruby/blob/trunk/lib/uri/generic.rb#L1341
     # Constructs String from URI
     #
     def to_s
-      str = String.new
+      str = ''.dup
       if @scheme
         str << @scheme
         str << ':'
Index: test/uri/test_generic.rb
===================================================================
--- test/uri/test_generic.rb	(revision 53534)
+++ test/uri/test_generic.rb	(revision 53535)
@@ -768,6 +768,7 @@ class URI::TestGeneric < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/uri/test_generic.rb#L768
   def test_build
     u = URI::Generic.build(['http', nil, 'example.com', 80, nil, '/foo', nil, nil, nil])
     assert_equal('http://example.com:80/foo', u.to_s)
+    assert_equal(Encoding::UTF_8, u.to_s.encoding)
 
     u = URI::Generic.build(:port => "5432")
     assert_equal(":5432", u.to_s)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53534)
+++ ChangeLog	(revision 53535)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Thu Jan 14 20:01:00 2016  NARUSE, Yui  <naruse@r...>
+
+	* lib/uri/generic.rb (URI::Generic#to_s): change encoding to
+	  UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@g...>
+	  https://github.com/ruby/ruby/pull/1188 fix GH-1188
+
 Thu Jan 14 17:36:16 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* variable.c (rb_f_global_variables): add matched back references

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

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