W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2012

[whatwg] API for encoding/decoding ArrayBuffers into text

From: James Graham <jgraham@opera.com>
Date: Wed, 14 Mar 2012 10:07:45 +0100
Message-ID: <4F605FE1.3010008@opera.com>
On 03/14/2012 12:38 AM, Tab Atkins Jr. wrote:
> On Tue, Mar 13, 2012 at 4:11 PM, Glenn Maynard<glenn at zewt.org>  wrote:
>> The API on that wiki page is a reasonable start.  For the same reasons that
>> we discussed in a recent thread (
>> http://lists.w3.org/Archives/Public/public-webapps/2011JulSep/1589.html),
>> conversion errors should use replacement (eg. U+FFFD), not throw
>> exceptions.
>
> Python throws errors by default, but both functions have an additional
> argument specifying an alternate strategy.  In particular,
> bytes.decode can either drop the invalid bytes, replace them with a
> replacement char (which I agree should be U+FFFD), or replace them
> with XML entities; str.encode can choose to drop characters the
> encoding doesn't support.

For completeness I note that python also allows user-provided custom 
error handling. I'm not suggesting we want this, but I would strongly 
prefer it to providing an XML-entity-encode option :)
Received on Wednesday, 14 March 2012 02:07:45 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:40 UTC