summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-14 11:20:24 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-14 11:20:24 +0000
commitaa90e3b85996c5e6c2ed2b337c0dd055802f11a1 (patch)
tree1c909e8ead21d042b8c57044ee75e359b67a887e
parent92e803c9c8e7cebe937c5ba05312417dbf99d688 (diff)
* lib/uri/generic.rb (URI::Generic#to_s): change encoding to
UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@gmail.com> https://github.com/ruby/ruby/pull/1188 fix GH-1188 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/uri/generic.rb2
-rw-r--r--test/uri/test_generic.rb1
3 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b59d440..538d2df 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Jan 14 20:01:00 2016 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * lib/uri/generic.rb (URI::Generic#to_s): change encoding to
+ UTF-8 as Ruby 2.2/ by Koichi ITO <koic.ito@gmail.com>
+ https://github.com/ruby/ruby/pull/1188 fix GH-1188
+
Thu Jan 14 17:36:16 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* variable.c (rb_f_global_variables): add matched back references
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb
index 224a163..aba54c1 100644
--- a/lib/uri/generic.rb
+++ b/lib/uri/generic.rb
@@ -1341,7 +1341,7 @@ module URI
# Constructs String from URI
#
def to_s
- str = String.new
+ str = ''.dup
if @scheme
str << @scheme
str << ':'
diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb
index eda6497..a427809 100644
--- a/test/uri/test_generic.rb
+++ b/test/uri/test_generic.rb
@@ -768,6 +768,7 @@ class URI::TestGeneric < Test::Unit::TestCase
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)