Accept Encoding object for Encoding.compatible? #457

Merged
merged 1 commit into from Jan 5, 2013

2 participants

@kou

With this change, the following calls are supported:

Encoding.compatible?(Encoding.find("UTF-8"),
                     "US-ASCII")
# => #<Encoding:UTF-8>

Encoding.compatible?("UTF-8",
                     Encoding.find("US-ASCII"))
# => #<Encoding:UTF-8>

Encoding.compatible?(Encoding.find("UTF-8"),
                     Encoding.find("US-ASCII"))
# => #<Encoding:UTF-8>

The following calls are supported before this changes:

Encoding.compatible?("UTF-8",
                     "US-ASCII")
# => #<Encoding:UTF-8>
@kou

Sorry. The example isn't correct. Please ignore it.

The following calls are supported before this changes:

Encoding.compatible?("UTF-8",
                     "US-ASCII")
# => #<Encoding:UTF-8>
@kou kou Accept Encoding object for Encoding.compatible?
With this change, the following calls are supported:

    Encoding.compatible?(Encoding.find("UTF-8"),
                         "String".force_encoding("UTF-8"))
    # => #<Encoding:UTF-8>

    Encoding.compatible?("String".force_encoding("UTF-8"),
                         Encoding.find("US-ASCII"))
    # => #<Encoding:UTF-8>

    Encoding.compatible?(Encoding.find("UTF-8"),
                         Encoding.find("US-ASCII"))
    # => #<Encoding:UTF-8>
a707f6c
@BanzaiMan BanzaiMan merged commit cc90601 into jruby:master Jan 5, 2013

1 check passed

Details default The Travis build passed
@BanzaiMan
JRuby Team member

Thank you!

@kou kou deleted the unknown repository branch Jan 5, 2013
@grosser grosser pushed a commit to grosser/test-unit that referenced this pull request Dec 20, 2013
@kou kou Add workaround for Encoding.compatible? on JRuby 1.7.1
The JRuby's problem will be fixed because a pull request has been sent:
  jruby/jruby#457
51a6d18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment