[Public WebGL] Question about Strings from TypedArrays
Tue Feb 15 16:31:31 PST 2011
I really liked the TypedArray spec. Excited to see two browser vendors
beginning to support it.
I'd like to resurrect the discussions around conversion of Strings from/to
TypedArrays . I take it from internal discussions with Kenneth that
nothing has happened yet on this front. Caveat upfront: I am not a browser
developer, I'm a front-end web developer.
Background: I was revisiting my implementation of unzip/inflate in
binary strings. However, I need some way to extract strings from chunks of
bytes. In my code, I wanted to avoid looping through each byte, using
String.fromCharCode() on it and appending to a JS String for some chunk of
I found out the following hack works in Firefox 4:
var bb = new Uint8Array(new ArrayBuffer(10));
bb = 65;
bb = 66;
bb = 67;
But this doesn't work in Chrome, unfortunately. I'm not sure which browser
is following the letter of the ECMAScript spec there.
What do you folks think of something as straightforward as this:
invalid encodings, etc. For the reverse conversion we could add another
constructor that takes a string and an encoding in.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the public_webgl