[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] String support in DataView

On Tue, Dec 27, 2011 at 1:54 PM, Joshua Bell <jsbell@chromium.org> wrote:
Hey folks - sorry for letting this linger again.

I'll pick up work on this draft in the new year. I'm leaning towards introducing an OptionsObject parameter on various methods that will allow for specifying:

FYI, Anne van Kesteren <annevk@opera.com> has started work on specifying the encodings themselves (discussion is over at whatwg).  Once his work is further along, it'll probably be an obvious normative reference for details of the encodings themselves.
  • Termination code points
  • Termination byte sequences (exclusive with previous)
This is very monolithic.  I think the API discussed earlier, with separate methods for for finding the end of the string, is much cleaner, and I don't think it has any notable drawbacks.
  • Replacement character (throw instead if unspecified)
I'd replace by default.  It's a less brittle default, since it won't fall over when people forget to test that code path (which will be common).  For Unicode targets the replacement character should be U+FFFD; for others the normal default is ?.

I'm not sure how useful specifying a different replacement character is.  I'd suggest having simply an "errors='fatal'" option, with a default of 'replace'.  (Another possible option later on, if there's demand for it, would be HTML-escapes, which would replace unrepresentable characters with &#1234; escapes, along with escaping &amp;.  That only makes sense for encoding, not decoding.)  If a different replacement character is useful, it can always be added as a separate option later on.

Glenn Maynard