aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/core_ext/uri.rb3
-rw-r--r--activesupport/test/core_ext/uri_ext_test.rb2
-rw-r--r--activesupport/test/multibyte_chars_test.rb2
3 files changed, 4 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/core_ext/uri.rb b/activesupport/lib/active_support/core_ext/uri.rb
index ca1be8b7e9..28eabd2111 100644
--- a/activesupport/lib/active_support/core_ext/uri.rb
+++ b/activesupport/lib/active_support/core_ext/uri.rb
@@ -1,8 +1,9 @@
+# encoding: utf-8
+
if RUBY_VERSION >= '1.9'
require 'uri'
str = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" # Ni-ho-nn-go in UTF-8, means Japanese.
- str.force_encoding(Encoding::UTF_8) if str.respond_to?(:force_encoding)
parser = URI::Parser.new
unless str == parser.unescape(parser.escape(str))
diff --git a/activesupport/test/core_ext/uri_ext_test.rb b/activesupport/test/core_ext/uri_ext_test.rb
index e4a242abc4..d988837603 100644
--- a/activesupport/test/core_ext/uri_ext_test.rb
+++ b/activesupport/test/core_ext/uri_ext_test.rb
@@ -1,3 +1,4 @@
+# encoding: utf-8
require 'abstract_unit'
require 'uri'
require 'active_support/core_ext/uri'
@@ -5,7 +6,6 @@ require 'active_support/core_ext/uri'
class URIExtTest < Test::Unit::TestCase
def test_uri_decode_handle_multibyte
str = "\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E" # Ni-ho-nn-go in UTF-8, means Japanese.
- str.force_encoding(Encoding::UTF_8) if str.respond_to?(:force_encoding)
if URI.const_defined?(:Parser)
parser = URI::Parser.new
diff --git a/activesupport/test/multibyte_chars_test.rb b/activesupport/test/multibyte_chars_test.rb
index 1b8d13c024..caf50aa1c9 100644
--- a/activesupport/test/multibyte_chars_test.rb
+++ b/activesupport/test/multibyte_chars_test.rb
@@ -105,7 +105,7 @@ class MultibyteCharsUTF8BehaviourTest < Test::Unit::TestCase
@whitespace = "\n\t#{[32, 8195].pack('U*')}"
else
# Ruby 1.9 only supports basic whitespace
- @whitespace = "\n\t ".force_encoding(Encoding::UTF_8)
+ @whitespace = "\n\t "
end
@byte_order_mark = [65279].pack('U')