title: Ruby 1.9 - Invalid multibyte character (utf-8)
body: <p>I have a ruby file with only these two lines:</p>
  
  <pre><code># encoding: utf-8
  puts "—"
  </code></pre>
  
  <p>When I run it with <code>ruby test_enc.rb</code> it fails with:</p>
  
  <pre><code>test_enc.rb:2: invalid multibyte char (UTF-8)
  test_enc.rb:2: unterminated string meets end of file
  </code></pre>
  
  <p>I don't know how to properly specify the character code of <code>—</code> (emdash), but vim tells me it is <code>151, Hex 97, Octal 227</code>. It fails the same way with other characters like <code>ã</code> as well, so I doubt it is related specifically to that character.
  I am running on Windows XP and the version of ruby I'm using is:</p>
  
  <pre><code>ruby 1.9.1p430 (2010-08-16 revision 28998) [i386-mingw32]
  </code></pre>
  
  <p>I feel like there is something very obvious I am missing here. Any ideas?</p>
  
  <p><strong>EDIT:</strong> Learned a valuable lesson about assumptions today - specifically assuming your editor IS using UTF-8 without actually checking it. Oops!</p>
  
  <p>Thanks for the quick and accurate replies all!</p>
  
  <p><strong>EDIT AGAIN:</strong> The 'setting up vim properly for utf-8' grew too big and wasn't really relevant to this question, so it is now a <a href="https://stackoverflow.com/questions/5477565/how-to-setup-vim-properly-for-editing-in-utf-8">separate question</a>.</p>