aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
diff options
context:
space:
mode:
authorJustin Coyne <justin@curationexperts.com>2014-02-01 22:13:07 -0600
committerJustin Coyne <justin@curationexperts.com>2014-02-10 08:10:44 -0600
commitae28e4beb3d9b395ee269999111b6598802da63f (patch)
tree950320c8bacb7070464cc08182cdcf2558436fea /activesupport/lib
parent07c70245a128cfe42f134be8759963dc98f1a63e (diff)
downloadrails-ae28e4beb3d9b395ee269999111b6598802da63f.tar.gz
rails-ae28e4beb3d9b395ee269999111b6598802da63f.tar.bz2
rails-ae28e4beb3d9b395ee269999111b6598802da63f.zip
Fix tidy_bytes for JRuby
The previous implementation was broken because JRuby (1.7.10) doesn't have a code converter for UTF-8 to UTF8-MAC.
Diffstat (limited to 'activesupport/lib')
-rw-r--r--activesupport/lib/active_support/multibyte/unicode.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/multibyte/unicode.rb b/activesupport/lib/active_support/multibyte/unicode.rb
index 7e518d8c39..ea3cdcd024 100644
--- a/activesupport/lib/active_support/multibyte/unicode.rb
+++ b/activesupport/lib/active_support/multibyte/unicode.rb
@@ -233,16 +233,16 @@ module ActiveSupport
# We're going to 'transcode' bytes from UTF-8 when possible, then fall back to
# CP1252 when we get errors. The final string will be 'converted' back to UTF-8
# before returning.
- reader = Encoding::Converter.new(Encoding::UTF_8, Encoding::UTF_8_MAC)
+ reader = Encoding::Converter.new(Encoding::UTF_8, Encoding::UTF_16LE)
source = string.dup
- out = ''.force_encoding(Encoding::UTF_8_MAC)
+ out = ''.force_encoding(Encoding::UTF_16LE)
loop do
reader.primitive_convert(source, out)
_, _, _, error_bytes, _ = reader.primitive_errinfo
break if error_bytes.nil?
- out << error_bytes.encode(Encoding::UTF_8_MAC, Encoding::Windows_1252, invalid: :replace, undef: :replace)
+ out << error_bytes.encode(Encoding::UTF_16LE, Encoding::Windows_1252, invalid: :replace, undef: :replace)
end
reader.finish