Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: JRuby 1.7.0.RC2
    • Component/s: Encoding
    • Labels:
      None
    • Environment:
      Mac OS X 10.7.3
    • Number of attachments :
      0

      Description

      the bug is that jrubys String#encode! doesn't handle the case where the first and only argument is the hash of options.

        Activity

        Hide
        Dominik Honnef added a comment - - edited

        To clarify, when String#encode! is called with no arguments or only options as the argument, it should behave as follows: if Encoding.default_internal is not nil, use that as the destination encoding. If it is nil, do nothing.

        Show
        Dominik Honnef added a comment - - edited To clarify, when String#encode! is called with no arguments or only options as the argument, it should behave as follows: if Encoding.default_internal is not nil, use that as the destination encoding. If it is nil, do nothing.
        Hide
        Diego Plentz added a comment -

        I've tried to reproduce the problem you're talking about but either it was already fixed or I didn't understood what you trying to report. It would be cool if you can provide a test that reproduce your problem(you can use one of those as model https://github.com/plentz/jruby_report)

        Show
        Diego Plentz added a comment - I've tried to reproduce the problem you're talking about but either it was already fixed or I didn't understood what you trying to report. It would be cool if you can provide a test that reproduce your problem(you can use one of those as model https://github.com/plentz/jruby_report )
        Hide
        Dominik Honnef added a comment -

        https://gist.github.com/2ce65458a7d39e62ac82 includes three tests; one is a simple sanity check, the other two demonstrate the problem.

        When String#encode! is only called with an options hash, it should use Encoding.default_internal as the target encoding. But JRuby things the hash itself is the target encoding, thus cannot find a converter and raises an exception.

        The test passes on YARV 1.9.3, and fails on "jruby 1.7.0.dev (ruby-1.9.3-p139) (2012-04-22 969ffa0)"

        I hope this helps

        Show
        Dominik Honnef added a comment - https://gist.github.com/2ce65458a7d39e62ac82 includes three tests; one is a simple sanity check, the other two demonstrate the problem. When String#encode! is only called with an options hash, it should use Encoding.default_internal as the target encoding. But JRuby things the hash itself is the target encoding, thus cannot find a converter and raises an exception. The test passes on YARV 1.9.3, and fails on "jruby 1.7.0.dev (ruby-1.9.3-p139) (2012-04-22 969ffa0)" I hope this helps
        Hide
        ryenus added a comment -

        Dominik is right.

        I've reproduced it and submitted pull request https://github.com/jruby/jruby/pull/183

        Show
        ryenus added a comment - Dominik is right. I've reproduced it and submitted pull request https://github.com/jruby/jruby/pull/183

          People

          • Assignee:
            Unassigned
            Reporter:
            Anonymous Secret
          • Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: