title: `scan': invalid byte sequence in UTF-8 (ArgumentError)
body: <p>I'm trying to read a <code>.txt</code> file in ruby and split the text line-by-line.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>def file_read(filename)
    File.open(filename, 'r').read
  end
  
  puts f = file_read('alice_in_wonderland.txt')
  </code></pre>
  
  <p>This <strong>works perfectly</strong>. But when I add the method <code>line_cutter</code> like this:</p>
  
  <pre><code>def file_read(filename)
    File.open(filename, 'r').read
  end
  
  def line_cutter(file)
    file.scan(/\w/)
  end
  
  puts f = line_cutter(file_read('alice_in_wonderland.txt'))
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>`scan': invalid byte sequence in UTF-8 (ArgumentError)
  </code></pre>
  
  <p>I found <a href="http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/" rel="noreferrer">this</a> online for untrusted website and tried to use it for my own code but it's not working. How can I remove this error?</p>
  
  <p>Link to the file: <a href="http://www.ccs.neu.edu/home/vip/teach/Algorithms/7_hash_RBtree_simpleDS/hw_hash_RBtree/alice_in_wonderland.txt" rel="noreferrer">File</a></p>