Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.1
    • Fix Version/s: JRuby 1.6.3
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      Windows 7 SP1 x64, Java 1.6.0_21, JRuby 1.6.1
    • Testcase included:
      yes
    • Number of attachments :
      1

      Description

      I'm using 1.9 mode of latest JRuby on Windows. When rstrip applied to utf-8 string with unicode char at the end it brokes string, removing one byte from the end. On MRI Ruby 1.9.2 it works as expected.

      I put minitest-bases test in attachment. If you doesn't accept minitest - write please which test framework should I use.

        Activity

        Hide
        Maxim Sokolovsky added a comment -

        minitest-based test unit.

        Show
        Maxim Sokolovsky added a comment - minitest-based test unit.
        Hide
        Clemens Fuchslocher added a comment -

        Same problem here.

        The test works with Ruby 1.9.2 but fails with JRuby 1.6.1:

        1. Ruby 1.9.2:

        $ ruby --version
        ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
        
        $ ruby test_string_rstrip.rb 
        Loaded suite test_string_rstrip
        Started
        .
        Finished in 0.001000 seconds.
        
        1 tests, 1 assertions, 0 failures, 0 errors, 0 skips
        
        Test run options: --seed 65479
        

        2. JRuby 1.6.1:

        $ jruby --1.9 --version
        jruby 1.6.1 (ruby-1.9.2-p136) (2011-04-12 85838f6) (Java HotSpot(TM) Client VM 1.6.0_24) [linux-i386-java]
        
        $ export LC_ALL=en_US.utf8
        
        $ jruby --1.9 -e "require 'java'; p java.lang.System.getProperty('file.encoding');"
        "UTF-8"
        
        $ jruby --1.9 test_string_rstrip.rb 
        Loaded suite test_string_rstrip
        Started
        F
        Finished in 0.023000 seconds.
        
          1) Failure:
        test_0001_should_return_same_string(StringSpec::WhenRstripAppliedToUtf8StringWithUnicodeCharAtTheEndAndWithoutTrailingWhitespaceSpec) [test_string_rstrip.rb:11]:
        Expected "\xD0\xBF\xD1\x80\xD0\xBE\xD0\xB2\xD0\xB5\xD1\x80\xD0\xBA\xD0\xB0", not "\xD0\xBF\xD1\x80\xD0\xBE\xD0\xB2\xD0\xB5\xD1\x80\xD0\xBA\xD0".
        
        1 tests, 1 assertions, 1 failures, 0 errors, 0 skips
        
        Test run options: --seed 32847
        
        Show
        Clemens Fuchslocher added a comment - Same problem here. The test works with Ruby 1.9.2 but fails with JRuby 1.6.1: 1. Ruby 1.9.2: $ ruby --version ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux] $ ruby test_string_rstrip.rb Loaded suite test_string_rstrip Started . Finished in 0.001000 seconds. 1 tests, 1 assertions, 0 failures, 0 errors, 0 skips Test run options: --seed 65479 2. JRuby 1.6.1: $ jruby --1.9 --version jruby 1.6.1 (ruby-1.9.2-p136) (2011-04-12 85838f6) (Java HotSpot(TM) Client VM 1.6.0_24) [linux-i386-java] $ export LC_ALL=en_US.utf8 $ jruby --1.9 -e "require 'java'; p java.lang.System.getProperty('file.encoding');" "UTF-8" $ jruby --1.9 test_string_rstrip.rb Loaded suite test_string_rstrip Started F Finished in 0.023000 seconds. 1) Failure: test_0001_should_return_same_string(StringSpec::WhenRstripAppliedToUtf8StringWithUnicodeCharAtTheEndAndWithoutTrailingWhitespaceSpec) [test_string_rstrip.rb:11]: Expected "\xD0\xBF\xD1\x80\xD0\xBE\xD0\xB2\xD0\xB5\xD1\x80\xD0\xBA\xD0\xB0", not "\xD0\xBF\xD1\x80\xD0\xBE\xD0\xB2\xD0\xB5\xD1\x80\xD0\xBA\xD0". 1 tests, 1 assertions, 1 failures, 0 errors, 0 skips Test run options: --seed 32847
        Hide
        Thomas E Enebo added a comment -

        Fixed in commit 9ccc428 on master and 4c39f16 on 1.6 branch

        Show
        Thomas E Enebo added a comment - Fixed in commit 9ccc428 on master and 4c39f16 on 1.6 branch
        Hide
        Maxim Sokolovsky added a comment -

        Confirming that it's ok - test passed on Windows 7 with JRuby 1.6.4. Big thanks =)

        Show
        Maxim Sokolovsky added a comment - Confirming that it's ok - test passed on Windows 7 with JRuby 1.6.4. Big thanks =)

          People

          • Assignee:
            Thomas E Enebo
            Reporter:
            Maxim Sokolovsky
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: