Read more

How to silence UTF-8 warnings on Rails 2.3 with Ruby 1.9

Arne Hartherz
February 22, 2013Software engineer at makandra GmbH

Rails 2.3.16+ on Ruby 1.9 causes warnings like this:

.../gems/activesupport-2.3.17/lib/active_support/core_ext/string/output_safety.rb:22: warning: regexp match /.../n against to UTF-8 string
Illustration book lover

Growing Rails Applications in Practice

Check out our e-book. Learn to structure large Ruby on Rails codebases with the tools you already know and love.

  • Introduce design conventions for controllers and user-facing models
  • Create a system for growth
  • Build applications to last
Read more Show archive.org snapshot

Many thanks to grosser for supplying a monkey-patch for Rails 2.3 Show archive.org snapshot (Commit f93e3f0ec3 Show archive.org snapshot fixed it for Rails 3). Just put it into config/initializers/ to make those warnings go away.

Since we're using RSpec on most projects, I've transformed the test for it to a spec. See the attached link.

Posted by Arne Hartherz to makandra dev (2013-02-22 14:43)