On 1/11/2012 2:49 PM, James Robinson wrote:
On Wed, Jan 11, 2012 at 2:45 PM, Charles Pritchard <[email protected]
<mailto:[email protected]>> wrote:
Currently, we can asynchronously use BlobBuilder with FileReader
to get an array buffer from a string.
We can of course, use code to convert String.fromCharCode into a
Uint8Array, but it's ugly.
The StringEncoding proposal seems a bit much for most web use:
http://wiki.whatwg.org/wiki/StringEncoding
All we really ever do is work on DOMString, and that's covered by
UTF8.
DOMString is not UTF8 or necessarily unicode. It's a sequence of 16
bit integers and a length.
To clarify, I'd want ArrayBuffer(DOMString) to work with unicode and
throw an error if the DOMString is not valid unicode.
This is consistent with other Web Apps APIs.
For feature detection, the method should be wrapped in a try-catch block
anyway.
-Charles