Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Encoding::UndefinedConversionError when using console formatter #480

mzimen opened this Issue · 4 comments

5 participants


During printing content from some ssh output we sometime notice this error:

"\xE2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/formatter/console.rb:187:in write'
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/formatter/console.rb:187:in print_message'
block in print_messages'
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/formatter/console.rb:175:in each'
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/formatter/pretty.rb:153:in step_name'
block in send_to_all'
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/ast/tree_walker.rb:172:in each'
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/ast/tree_walker.rb:166:in broadcast'
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/ast/tree_walker.rb:105:in block in visit_step_result'
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/ast/tree_walker.rb:104:in visit_step_result'
/usr/local/share/gems/gems/cucumber-1.2.3/lib/cucumber/ast/step_invocation.rb:39:in `accept'

@os97673 os97673 was assigned

We need a lot more help to reproduce this.

What environment does this happen in? CI? What operating system? Is there a particular feature file that causes this?


This issue happens when launching/displaying ssh command, which generates some UTF8 output. The ssh command is launched via Open3 ruby library.
Operating system: Fedora18
AFAIK something similar happened, when inside the step, there was an attempt to get web page with curl http://... which had used UTF8 formatting. When I get more information, I will put it here.

@tooky tooky added the Bug label
@mattwynne mattwynne removed the Bug label
@tooky tooky modified the milestone: 2.1, 1.3
@mattwynne mattwynne added the Bug label

I have been seeing this error and exit a lot lately using the junit or prettyface formatters. Have seen it using 1.3.18 and 1.3.19 (haven't migrated to 2.0 yet). Unfortunately, this happens intermittently and rarely on a particular scenario. Not sure if this helps but ran a quick check to see if there's any non UTF-8 chars in any of my files, but looks like everything is UTF-8.

all_encoding = []
Dir.glob('features/**/*.rb').each do |file|
  all_encoding.push( { |line| line.to_s.encoding })

all_encoding.flatten.count { |encoding| != 'UTF-8' } # 0

As a workaround, wondering if there's a simple way to globally swallow the exception so that our test executions don't randomly terminate.

Let me know if there's anything I can provide to help triage the issue. Has anyone else been running into this lately?


In my experience the problematic string may come from one of library/sdk call, so encoding of your files are not the only possible source of the problem :(
As for helpful information: more up-to-date backtrace and (if you will be able to create one) the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.