- From: Artyom Egorov <notifications@github.com>
- Date: Tue, 19 Apr 2016 06:01:05 -0700
- To: whatwg/encoding <encoding@noreply.github.com>
Received on Tuesday, 19 April 2016 13:01:33 UTC
Omg, it seems I was wrong about it complexity. It is what I was looking for:
```js
function strToUtf16le(str) {
const utf16 = [];
const eightBitMask = (1 << 8) - 1;
for (let i = 0; i < str.length; i++) {
const charCode = str.charCodeAt(i);
utf16.push(charCode & eightBitMask);
utf16.push(charCode >>> 8);
}
return utf16;
}
```
---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/encoding/issues/18#issuecomment-211915765
Received on Tuesday, 19 April 2016 13:01:33 UTC