title: Write and read a file with utf-8 encoding
body: <p>I've been reading up on all the UTF-8 related questions and blog posts, and I've got the following example in a test.rb file:</p>
  
  <pre><code># encoding: UTF-8
  File.open("test.txt", "w") do |f|
    f.write "test © foo"
  end
  
  File.open("test.txt", "r") do |f|
    puts f.read
  end
  </code></pre>
  
  <p>this works perfectly. is produces the © symbol correctly in the file, and it reads the © back to me and prints it on the screen.</p>
  
  <p>but when I use this same code in my actual project, i get this written to the file instead of the © symbol: <code>\u00A9</code></p>
  
  <p>FWIW: I'm getting this result when running an rspec (v1.2.9) test against my code. the spec produces a file with a © symbol in it, and then reads the file back in to check the contents. </p>
  
  <p>I'm running this in Ruby 1.9.2 at the moment, but I also need to support all the way back to Ruby 1.8.6. This is a Windows environment with RubyInstaller.org versions of Ruby.</p>