[LRUG] More encoding shenanigans

Andrew Stewart boss at airbladesoftware.com
Wed Feb 1 02:22:15 PST 2012


Hola El Rug,

Following on from last week's fun and games with MySQL character encodings, this week I have the pleasure of working on a different Rails app which has just moved from Ruby 1.8.6 to 1.9.2-p290.  I'm getting this error on some pages:

```
A ArgumentError occurred in application#index:

 invalid byte sequence in US-ASCII
 /var/www/apps/cisapp/shared/bundle/ruby/1.9.1/gems/activesupport-2.3.14/lib/active_support/core_ext/object/blank.rb:68:in `=~'
```

Things seems to be fine at the model level in the Rails console.

There are a million and one blog posts about this but so far none has solved my problem.

Here's my setup:

- Rails 2.3.14

- Ruby 1.9.2-p290

- At the bottom of config/environment.rb:

    Encoding.default_external = Encoding::UTF_8
    Encoding.default_internal = Encoding::UTF_8

- Using mysql2 driver with utf8 encoding.  Database is latin-1 (but no illegal-mix-of-collations errors...so far).

Can anyone help?

Thanks in advance,
Andy

-------
http://airbladesoftware.com


More information about the Chat mailing list