How do I encode a JavaScript string in utf-16?
<p>In Python 3, I can do this:</p>

<pre><code>&gt;&gt;&gt; "€13,56".encode('utf-16')
b'\xff\xfe\xac 1\x003\x00,\x005\x006\x00'
</code></pre>

<p>The input is a (unicode) string, while the output is a sequence of raw bytes of that string encoded in utf-16.</p>

<p>How can I do the same in JavaScript - go from a (unicode) string, to a sequence of raw bytes (perhaps as a <code>Uint8Array</code>?) of that string encoded in utf-16?</p>