Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"Encoding::UndefinedConversionError: Input length = 1" with JRuby-1.7.0.RC on Windows XP #336

@efelix

Description

@efelix

Hello!

When I do this:

C:\Documents and Settings\flx>jruby -v
jruby 1.7.0.RC1 (1.9.3p203) 2012-09-25 8e849de on Java HotSpot(TM) Client VM 1.7
.0_07-b11 [Windows XP-x86]

C:\Documents and Settings\flx>jgem install cucumber
Successfully installed json-1.7.5-java
Successfully installed gherkin-2.11.2-java
Successfully installed builder-3.1.3
Successfully installed diff-lcs-1.1.3
Successfully installed cucumber-1.2.1
5 gems installed

Here cucumber fail!!

C:\Documents and Settings\flx>cucumber
Encoding::UndefinedConversionError: Input length = 1
encode at org/jruby/RubyString.java:7468
initialize at json/ext/Parser.java:175
new at json/ext/Parser.java:151
parse at c:/ruby/jruby170/lib/ruby/gems/shared/gems/json-1.7.5-java/lib/j
son/common.rb:155
I18n at c:/ruby/jruby170/lib/ruby/gems/shared/gems/gherkin-2.11.2-java/l
ib/gherkin/i18n.rb:14
Gherkin at c:/ruby/jruby170/lib/ruby/gems/shared/gems/gherkin-2.11.2-java/l
ib/gherkin/i18n.rb:6
(root) at c:/ruby/jruby170/lib/ruby/gems/shared/gems/gherkin-2.11.2-java/l
ib/gherkin/i18n.rb:5
require at org/jruby/RubyKernel.java:1019
(root) at c:/ruby/jruby170/lib/ruby/shared/rubygems/custom_require.rb:1
require at c:/ruby/jruby170/lib/ruby/shared/rubygems/custom_require.rb:36
require at org/jruby/RubyKernel.java:1019
(root) at c:/ruby/jruby170/lib/ruby/gems/shared/gems/gherkin-2.11.2-java/l
ib/gherkin/lexer/i18n_lexer.rb:1
(root) at c:/ruby/jruby170/lib/ruby/shared/rubygems/custom_require.rb:1
require at org/jruby/RubyKernel.java:1019
require at c:/ruby/jruby170/lib/ruby/shared/rubygems/custom_require.rb:36
(root) at c:/ruby/jruby170/lib/ruby/gems/shared/gems/gherkin-2.11.2-java/l
ib/gherkin.rb:1
require at org/jruby/RubyKernel.java:1019
(root) at c:/ruby/jruby170/lib/ruby/shared/rubygems/custom_require.rb:1
require at c:/ruby/jruby170/lib/ruby/shared/rubygems/custom_require.rb:36
load at org/jruby/RubyKernel.java:1045
(root) at c:\ruby\jruby170\bin\cucumber:23

The same with MRI Ruby 1.9.4 with no problem.

C:\Documents and Settings\flx>ruby -v
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]

C:\Documents and Settings\flx>gem install cucumber
Successfully installed gherkin-2.11.2-x86-mingw32
Successfully installed builder-3.1.3
Successfully installed diff-lcs-1.1.3
Successfully installed cucumber-1.2.1
4 gems installed

First time fail ...

C:\Documents and Settings\flx>cucumber
c:/ruby/ruby193/lib/ruby/1.9.1/json/common.rb:148:in encode': "\x81" to UTF-8 i
n conversion from Windows-1252 to UTF-8 (Encoding::UndefinedConversionError)
from c:/ruby/ruby193/lib/ruby/1.9.1/json/common.rb:148:ininitialize'
from c:/ruby/ruby193/lib/ruby/1.9.1/json/common.rb:148:in new'
from c:/ruby/ruby193/lib/ruby/1.9.1/json/common.rb:148:inparse'
from c:/ruby/ruby193/lib/ruby/gems/1.9.1/gems/gherkin-2.11.2-x86-mingw32
/lib/gherkin/i18n.rb:14:in `class:I18n' ......

FIXed!! set windows enviroment var => LANG=en_US.UTF-8

C:\Documents and Settings\flx>cucumber
*** WARNING: You must use ANSICON 1.31 or higher (http://adoxa.110mb.com/ansicon
) to get coloured output on Windows
....

LANG=en_US.UTF-8 not work with cucumber on JRuby.

I do the same test on Ubuntu and work fine.Is a windows issue.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions