Re: [whatwg] API for encoding/decoding ArrayBuffers into text

2012-03-22 Thread Anne van Kesteren
On Thu, 22 Mar 2012 03:12:25 +0100, Mark Callow callow_m...@hicorp.co.jp wrote: This has encode and decode reversed from my understanding. I regard the string (wide-char) as the canonical form and the bytes as the encoded form. This view is reflected in the widely used terminology charset

Re: [whatwg] API for encoding/decoding ArrayBuffers into text

2012-03-22 Thread Anne van Kesteren
On Wed, 21 Mar 2012 16:53:36 +0100, Joshua Bell jsb...@chromium.org wrote: Just to throw it out there - does anyone feel we can/should offer asymmetric encode/decode support, i.e. supporting more encodings for decode operations than for encode operations? XMLHttpRequest has that. You can

Re: [whatwg] API for encoding/decoding ArrayBuffers into text

2012-03-22 Thread Anne van Kesteren
On Thu, 22 Mar 2012 10:19:30 +0100, Anne van Kesteren ann...@opera.com wrote: They can use the prefixed variants :-) If we have to use a prefix String seems better, as Text is a node object in the platform. Simon pointed out Text as prefix is probably better (it is used elsewhere in the

Re: [whatwg] API for encoding/decoding ArrayBuffers into text

2012-03-22 Thread James Graham
On 03/21/2012 04:53 PM, Joshua Bell wrote: As for the API, how about: enc = new Encoder(euc-kr) string1 = enc.encode(bytes1) string2 = enc.encode(bytes2) string3 = enc.eof() // might return empty string if all is fine And similarly you would have dec = new Decoder(shift_jis)

Re: [whatwg] API for encoding/decoding ArrayBuffers into text

2012-03-22 Thread Glenn Maynard
On Wed, Mar 21, 2012 at 2:42 PM, Anne van Kesteren ann...@opera.com wrote: As for the API, how about: enc = new Encoder(euc-kr) string1 = enc.encode(bytes1) string2 = enc.encode(bytes2) string3 = enc.eof() // might return empty string if all is fine A problem with this is that the

Re: [whatwg] API for encoding/decoding ArrayBuffers into text

2012-03-22 Thread Anne van Kesteren
On Thu, 22 Mar 2012 14:47:05 +0100, Glenn Maynard gl...@zewt.org wrote: A problem with this is that the bugs resulting from not calling eof() are subtle. The only thing eof() would ever do, I think, is return U+FFFD characters if there are leftover characters in the internal buffer; if you

Re: [whatwg] API for encoding/decoding ArrayBuffers into text

2012-03-22 Thread NARUSE, Yui
2012/3/22 Anne van Kesteren ann...@opera.com: As for the API, how about:  enc = new Encoder(euc-kr)  string1 = enc.encode(bytes1)  string2 = enc.encode(bytes2)  string3 = enc.eof() // might return empty string if all is fine And similarly you would have  dec = new Decoder(shift_jis)