I'm on Windows 7, running with Ruby 1.9.3 (also tested in 1.8.7)
When I type (Cygwin)
cucumber.bat features\ -p dev
I get the following stack trace
invalid byte sequence in UTF-8 (ArgumentError)
C:/Ruby193/lib/ruby/gems/1.9.1/gems/gherkin-2.12.0-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:24:in `strip!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/gherkin-2.12.0-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:24:in `scan'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/gherkin-2.12.0-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb:24:in `scan'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/gherkin-2.12.0-x86-mingw32/lib/gherkin/parser/parser.rb:33:in `parse'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/lib/cucumber/feature_file.rb:37:in `parse'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/lib/cucumber/runtime/features_loader.rb:28:in `block in load'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/lib/cucumber/runtime/features_loader.rb:26:in `each'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/lib/cucumber/runtime/features_loader.rb:26:in `load'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/lib/cucumber/runtime/features_loader.rb:14:in `features'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/lib/cucumber/runtime.rb:178:in `features'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/lib/cucumber/runtime.rb:48:in `run!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/lib/cucumber/cli/main.rb:47:in `execute!'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/cucumber-1.3.2/bin/cucumber:13:in `<top (required)>'
C:/Ruby193/bin/cucumber:23:in `load'
C:/Ruby193/bin/cucumber:23:in `<main>'
I know it says cucumber 1.3.2, but I tried with 1.3.6 and received the same error.
When I try to run only one feature file
cucumber.bat features\awesomestuff.feature -p dev
It works like a charm.
As a temporary work around, I edited the C:/Ruby193/lib/ruby/gems/1.9.1/gems/gherkin-2.12.0-x86-mingw32/lib/gherkin/lexer/i18n_lexer.rb
Original method:
def scan(source)
create_delegate(source).scan(source)
end
New method:
def scan(source)
source.encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '')
source.encode!('UTF-8', 'UTF-16')
create_delegate(source).scan(source)
end
Source for change:
http://stackoverflow.com/questions/2982677/ruby-1-9-invalid-byte-sequence-in-utf-8Now, it works correctly. My questions:
Is there a more permanent solution that doesn't require editing the gem (which does make me a little uncomfortable)?
Is there a downside to my solution that I have not foreseen?