This project is archived and is in readonly mode.

#5593 ✓invalid
Mike Leddy

Rails 3.0.0 ActionDispatch::Response.default_charset not initialized

Reported by Mike Leddy | September 9th, 2010 @ 05:35 PM

My rails app was returning some pages with "Content-Type: text/html; charset=" which messed up page rendering in the browser.

In actionpack/lib/action_dispatch/http/response.rb on line 137 the intention seems to be to initialize the attribute with utf8 ie:

cattr_accessor(:default_charset) { "utf-8" }

However in extlib 0.9.15 cattr_accessor does not accept a block. I have worked around this with the line:

ActionDispatch::Response.default_charset="utf-8"

in my rails apps config/application.rb

Comments and changes to this ticket

  • Mike Leddy

    Mike Leddy September 9th, 2010 @ 05:52 PM

    Further investigation leads me to the fact that:

    activesupport-3.0.0/lib/active_support/core_ext/class/attribute_accessors.rb

    adds block handling to cattr_accessor.

    However, I have no idea why it isn't working. I have a clean user rvm install of ruby-1.9.2-p0.

  • Mike Leddy

    Mike Leddy September 9th, 2010 @ 06:53 PM

    • Tag changed from rails 3.0.0 to rails 3.0.0, resolved

    Please ignore - Not a bug but a gem conflict. I had unnecessarily included extlib in the app's Gemfile (its used by non-rails parts of my application).

  • Rohit Arondekar

    Rohit Arondekar September 12th, 2010 @ 05:08 AM

    • State changed from “new” to “invalid”
    • Importance changed from “” to “Low”
  • Sam Woodard

    Sam Woodard February 8th, 2011 @ 11:12 PM

    This is super helpful. Beware of extlib, it does exactly what Mike describes above. My issue was that I had chef in my Gemfile which requires extlib.

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Pages