title: Error 'incompatible character encodings: ASCII-8BIT and UTF-8' due to 8-bit encoding of cookies (Rails 3 and Ruby 1.9)
body: <p>I moved a web app that was using 1.8.7 to 1.9.2 and now I keep getting</p>
  
  <pre><code>incompatible character encodings: ASCII-8BIT and UTF-8
  </code></pre>
  
  <p>I have the database encoding to UTF-8 and I have also 'config.encoding = "utf-8"'.</p>
  
  <p>I saw some ideas as possible workarounds and I added</p>
  
  <pre><code>Encoding.default_external = Encoding::UTF_8
  Encoding.default_internal = Encoding::UTF_8
  </code></pre>
  
  <p>But it didn't work either.</p>
  
  <p>One specific chunk of code where I am getting this error is</p>
  
  <pre><code>%ul.address
  - @user.address.split(',').each do |line|
    %li= line.titleize
  </code></pre>
  
  <p>I'm using HAML, I checked line.titleize, and the encoding is UTF-8. Seems that the template is being rendered with ASCII-8BIT and it gets screwed each time that I try to render characteres like 'ñ'</p>
  
  <p>I'm working with Rails 3.0.5.</p>
  
  <p>I have read the post by James Edward Gray, but I still can figure it out what is going on ;(.</p>
  
  <p>I'd really appreciate any kind of help :D.</p>
  
  <p>I also tried:</p>
  
  <pre><code>"string".force_encoding("UTF-8")
  </code></pre>
  
  <p>And</p>
  
  <pre><code># encoding: utf-8
  </code></pre>
  
  <p>Without any luck.</p>
  
  <p>Fixed</p>
  
  <hr>
  
  <p>See comments.</p>