Re: [web-nfc] What's the value of `toJSON()`? (#366)

This won't work right:

  ```js
const records = [
    {
      recordType: "text",
      encoding: "utf-16",
      data: "bonjour",
      language: "fr"
    },
```

You probably need to do something like
```js
function a2utf16(string) {
  let result = new Uint16Array(string.length);
  for (let i = 0; i < string.length; i++) {
    result[i] = string.codePointAt(i);
  }
  return result;
}

data: a2utf16("bonjour"),

```

-- 
GitHub Notification of comment by kenchris
Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/366#issuecomment-542563056 using your GitHub account

Received on Wednesday, 16 October 2019 07:27:47 UTC