Permalink
Browse files

Use Encoding.default_external, not _internal

  • Loading branch information...
1 parent 76e971e commit 8d354bc792265ce8d125cbd868663b42fdbf8c9f @jeremy jeremy committed Sep 13, 2009
Showing with 10 additions and 10 deletions.
  1. +2 −2 activesupport/lib/active_support/multibyte/utils.rb
  2. +8 −8 activesupport/test/multibyte_utils_test.rb
@@ -5,7 +5,7 @@ module Multibyte #:nodoc:
if Kernel.const_defined?(:Encoding)
# Returns a regular expression that matches valid characters in the current encoding
def self.valid_character
- VALID_CHARACTER[Encoding.default_internal.to_s]
+ VALID_CHARACTER[Encoding.default_external.to_s]
end
else
def self.valid_character
@@ -58,4 +58,4 @@ def self.clean(string)
end
end
end
-end
+end
@@ -103,11 +103,11 @@ class MultibyteUtilsTest < ActiveSupport::TestCase
if Kernel.const_defined?(:Encoding)
def example(key)
- STRINGS[key].force_encoding(Encoding.default_internal)
+ STRINGS[key].force_encoding(Encoding.default_external)
end
def examples
- STRINGS.values.map { |s| s.force_encoding(Encoding.default_internal) }
+ STRINGS.values.map { |s| s.force_encoding(Encoding.default_external) }
end
else
def example(key)
@@ -121,21 +121,21 @@ def examples
if 'string'.respond_to?(:encoding)
def with_encoding(enc)
- before = Encoding.default_internal
+ before = Encoding.default_external
case enc
when 'UTF8'
- Encoding.default_internal = Encoding::UTF_8
+ Encoding.default_external = Encoding::UTF_8
when 'SJIS'
- Encoding.default_internal = Encoding::Shift_JIS
+ Encoding.default_external = Encoding::Shift_JIS
else
- Encoding.default_internal = Encoding::BINARY
+ Encoding.default_external = Encoding::BINARY
end
yield
- Encoding.default_internal = before
+ Encoding.default_external = before
end
else
alias with_encoding with_kcode
end
-end
+end

0 comments on commit 8d354bc

Please sign in to comment.