cucumber-ruby: invalid byte sequence in UTF-8 due to special character in step definition

Summary

Special characters in step definition like french accuentated characters prevent the HTML report from displaying the snippet:

invalid byte sequence in UTF-8 (ArgumentError)

-1# Couldn't get snippet for 

Expected Behavior

If a language is supported in Gherkin .feature file, it should also be supported in step definition (.rb file).

Current Behavior

The character ‘é’ is not handled properly in HTML report code snippet and breaks the report (no embedded screenshot, broken report on jenkins) report

Steps to Reproduce (for bugs)

cucumber --init

Create a test.feature file in the features folder

# language: fr
Fonctionnalité: Test

  Scénario: Issue with special character
    * é

Create a test.rb file in the features/step_definitions folder

Given /e/ do
	raise 'error'
end

Run cucumber

cucumber --format html --out report.html

Open report.html

Context & Motivation

I’m using fr language so any of my member of the team is able to understand the steps. A workaround for this would be really appreciated while a fix is not released.

Your Environment

  • Operating System and version: Debian 9.4.0 AMD64 gnome
cucumber --version
3.1.0

ruby --version
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

gem list
*** LOCAL GEMS ***

activemodel (5.1.5)
activerecord (5.1.5)
activesupport (5.1.5)
addressable (2.5.2)
anemone (0.7.2)
archive-zip (0.11.0)
arel (8.0.0)
ast (2.4.0)
autoparse (0.3.3)
backports (3.11.1)
bigdecimal (default: 1.3.4)
builder (3.2.3)
bundler (1.16.2)
bundler-unload (1.0.2)
childprocess (0.8.0)
chromedriver-helper (1.2.0)
cmath (default: 1.0.0)
concurrent-ruby (1.0.5)
csv (default: 1.0.0)
cucumber (3.1.0)
cucumber-core (3.1.0)
cucumber-expressions (5.0.13)
cucumber-tag_expressions (1.1.1)
cucumber-wire (0.0.1)
data_magic (1.2)
date (default: 1.0.0)
dbm (default: 1.0.0)
debase (0.2.2)
debase-ruby_core_source (0.10.3)
declarative (0.0.10)
declarative-option (0.1.0)
did_you_mean (1.2.0)
diff-lcs (1.3)
etc (default: 1.0.0)
executable-hooks (1.4.2)
extlib (0.9.16)
faker (1.8.7)
faraday (0.15.2)
fcntl (default: 1.0.0)
ffi (1.9.23)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
gdbm (default: 2.0.0)
gem-wrappers (1.3.2)
gherkin (5.0.0)
google-api-client (0.21.2)
googleauth (0.6.2)
headless (2.3.1)
httpclient (2.8.3)
i18n (0.9.5)
image_size (2.0.0, 1.5.0)
io-console (default: 0.4.6)
io-like (0.3.0)
ipaddr (default: 1.2.0)
json (default: 2.1.0)
jwt (2.1.0)
launchy (2.4.3)
little-plugger (1.1.4)
log4r (1.1.10)
logging (2.2.2)
memoist (0.16.0)
mime-types (3.1)
mime-types-data (3.2016.0521)
mini_magick (4.8.0)
mini_portile2 (2.3.0)
minitest (5.11.3, 5.10.3)
multi_json (1.13.1)
multi_test (0.1.2)
multipart-post (2.0.0)
mysql2 (0.4.10)
net-telnet (0.1.1)
nokogiri (1.8.2)
openssl (default: 2.1.0)
os (0.9.6)
page-object (2.2.4)
page_navigation (0.10)
parallel (1.12.1)
parser (2.5.1.0)
power_assert (1.1.1)
powerpack (0.1.1)
psych (default: 3.0.2)
public_suffix (3.0.2)
rainbow (3.0.0)
rake (12.3.0)
rdoc (default: 6.0.1)
representable (3.0.4)
require_all (1.5.0)
retriable (3.1.1, 1.4.1)
robotex (1.0.0)
rspec (3.7.0)
rspec-core (3.7.1)
rspec-expectations (3.7.0)
rspec-mocks (3.7.0)
rspec-support (3.7.1)
rubocop (0.56.0)
ruby-debug-ide (0.6.1)
ruby-progressbar (1.9.0)
rubygems-bundler (1.4.4)
rubyzip (1.2.1)
rvm (1.11.3.9)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
selenium-webdriver (3.10.0)
signet (0.8.1)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
syntax (1.2.2)
test-unit (3.2.7)
thor (0.20.0)
thread_safe (0.3.6)
tzinfo (1.2.5)
uber (0.1.0)
unicode-display_width (1.3.2)
watir (6.10.3)
watir-scroll (0.3.0)
webrick (default: 1.4.2)
wraith (4.2.1)
xmlrpc (0.3.0)
yml_reader (0.7)
zlib (default: 1.0.0)

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 28 (10 by maintainers)

Most upvoted comments

I’d like to take care of this during this Hacktoberfest!