Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.1
    • Fix Version/s: JRuby 1.7.4
    • Component/s: Application Error
    • Labels:
      None
    • Environment:
      Windows 7 x64, Oracle Java 1.6.0_21 x86, JRuby 1.6.1 x86
    • Number of attachments :
      0

      Description

      When trying to start UTF-8-BOM encoded file on JRuby 1.6.1:

      1.rb
      puts 'test'
      
      2.rb
      # encoding: utf-8
      puts 'test'
      
      C:\aXe1\dev\ruby\test\jruby>jruby -v
      jruby 1.6.1 (ruby-1.9.2-p136) (2011-04-12 85838f6) (Java HotSpot(TM) Client VM 1
      .6.0_21) [Windows 7-x86-java]
      
      C:\aXe1\dev\ruby\test\jruby>jruby 1.rb
      SyntaxError: 1.rb:1: \273Invalid char `\273' ('╗') in expression
      
      C:\aXe1\dev\ruby\test\jruby>jruby 2.rb
      SyntaxError: 2.rb:1: \273Invalid char `\273' ('╗') in expression
      

      So it fails on BOM,regardless on magic 'encoding' comment. On MRI Ruby 1.9.2p180 it works fine:

      C:\aXe1\dev\ruby\test\jruby>ruby -v
      ruby 1.9.2p180 (2011-02-18) [i386-mingw32]
      
      C:\aXe1\dev\ruby\test\jruby>ruby 1.rb
      test
      
      C:\aXe1\dev\ruby\test\jruby>ruby 2.rb
      test
      

        Activity

        Hide
        Thomas E Enebo added a comment -

        Fixed in commit 9ed0040

        Show
        Thomas E Enebo added a comment - Fixed in commit 9ed0040
        Hide
        Thomas E Enebo added a comment -

        Ah...An explanation might be useful. Charlie fixed this for IO/File methods. It was not fixed in the parser itself though. The weird thing is Ruby parser only seems to detect UTF-8 while IO will detect the whole family of UTF?

        Show
        Thomas E Enebo added a comment - Ah...An explanation might be useful. Charlie fixed this for IO/File methods. It was not fixed in the parser itself though. The weird thing is Ruby parser only seems to detect UTF-8 while IO will detect the whole family of UTF?
        Hide
        Yaroslav Markin added a comment -

        Thank-you!

        Show
        Yaroslav Markin added a comment - Thank-you!
        Hide
        Charles Oliver Nutter added a comment -

        The discrepancy between parser and IO/File would probably be good to report to ruby-core. I'd say it's a bug.

        Show
        Charles Oliver Nutter added a comment - The discrepancy between parser and IO/File would probably be good to report to ruby-core. I'd say it's a bug.
        Hide
        Charles Oliver Nutter added a comment -

        Oh, also note...Ruby 2.0 assumes UTF-8 always. Interesting choice, but one we've considered too.

        Show
        Charles Oliver Nutter added a comment - Oh, also note...Ruby 2.0 assumes UTF-8 always. Interesting choice, but one we've considered too.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: