[web-nfc] "Creating a Web NFC Id" not very rigorous

domenic has just created a new issue for https://github.com/w3c/web-nfc:

== "Creating a Web NFC Id" not very rigorous ==
> Let id be the ASCII serialized origin of the browsing context, appended with url. 

Which browsing context?

"x appended with y" is confusing to me. Is that `xy` or `yx`?

> If id is a not a valid URL, throw a "SyntaxError" exception and abort these steps. 

What is the algorithm for determining "valid URL"? Is it https://url.spec.whatwg.org/#valid-url-string ? My guess is you want to apply the basic URL parser and throw an exception if parsing fails.

Also, the name "url" is very confusing. It should be "urlPath", I think.

> Return id, encoded in UTF-16. 

Assuming UTF-16 is necessary for interop with legacy systems (we prefer UTF-8 on the web), you should use https://encoding.spec.whatwg.org/#decode. And specify UTF-16BE or UTF-16LE.

Note that even then a UTF-8 BOM would force UTF-8 encoding. Not sure if that's a problem or not...

Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/155 using your GitHub account

Received on Saturday, 29 September 2018 01:14:37 UTC