warning: regexp match /…/n against to UTF-8 string error when using Cucumber

Ever since updating my environment to Rails 3.0.0 / RSpec 2.0.0.beta.20 / Cucumber 0.8.5 / Capybara 0.3.9 / Autotest 4.3.2, I’ve been getting the following error when Cucumber runs my features:

It seems that Rack is having a problem whenever UTF-8 strings are sent in the params. Thankfully, these guys found a solution.

For a more verbose description, check out that page. Here’s the quick and dirty:

Install the escape_utils gem by including this in your Gemfile:

Run bundle install to install the gem. Now, create a new file: RAILS_ROOT/config/initializers/escape_utils.rb with the following content:

And that should do it!

14 thoughts on warning: regexp match /…/n against to UTF-8 string error when using Cucumber

  1. Pingback: InVisible Blog » Daily Log, 2010-11-01

  2. If you are using Rails 3 and escape_utils be warned that version 0.2.0 has a buffer over-read issue that will cause two characters to be truncated from your post parameters randomly under load. Once we upgraded to 0.2.3 the problem went away.

  3. Pingback: NOOB capybara Rspec warning: regexp match /…/n against to UTF-8 string - Programmers Goodies

  4. Just watch what you put in 3.2 and on production…. basically i have a unicorn error log full of “cache error: uninitialized constant Rack::Utils::EscapeUtils” and a line going to : home/blah/config/initializers/escape_utils.rb:7:in `escape’ in case google should cache this.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">