# Issues with globalize code from Rails Recipes

**URL:** <https://www.ruby-forum.com/t/issues-with-globalize-code-from-rails-recipes/97923>\
**Category:** Rails I18n\
**Created:** [July 11, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/issues-with-globalize-code-from-rails-recipes/97923 "2006-07-11T14:02:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/958977/32.png) [@chris](https://www.ruby-forum.com/u/chris)\
**Post date:** [July 11, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/issues-with-globalize-code-from-rails-recipes/97923/1 "2006-07-11T14:02:29Z")

</div>

I’m looking into using globalize for our corp intranet. I’m following  
the instructions from the Rails Recipes book. One issue I have come  
across involves the following snippet of code:

class ApplicationController \< ActionController::Base

after\_filter :set\_charset

def set\_charset  
unless @headers[“Content-Type”] =~ /charset/i  
@headers[“Content-Type”] ||= “”  
@headers[“Content-Type”] += “; charset=utf-8”  
end  
end  
end

this is directly from the book. what i am noticing is that the response  
headers are coming back to the browser as:

Content-Type: ;charset=utf-8

notice there is no actual content-type. if i force it to text/html

@headers[“Content-Type”] ||= “text/html”

i then see that the content-type is now set correctly and rjs appears to  
still work so I am wondering if this is a typo in the code from the book  
or is it something more.

Chris
