Win7 Powershell echo > text file = Ruby2.2: invalid multibyte char (UTF-8)?
<p>Can I use echo from the powershell command line to create text files which Ruby can parse?</p>

<pre><code>&gt;&gt;&gt; echo "# foobar" &gt; echo_test.rb
&gt;&gt;&gt; ruby echo_test.rb
echo_test.rb:1: invalid multibyte char (UTF-8)
</code></pre>

<p>Notepad++ reports the encoding as UCS-2 Little Endian. I also tried echo'ing with the the header options mentioned in this thread:
<a href="https://stackoverflow.com/questions/17859530/invalid-multibyte-char-utf-8-error-ruby">invalid multibyte char (UTF-8) Error, Ruby</a></p>

<p>e.g. </p>

<pre><code>&gt;&gt;&gt; echo "# encoding: utf-8" &gt; echo_test.rb
</code></pre>

<p>and got the same error message.</p>