- From: Norbert Lindenberg <ecmascript@lindenbergsoftware.com>
- Date: Tue, 9 Jul 2013 20:58:38 -0700
- To: Anne van Kesteren <annevk@annevk.nl>, public-script-coord <public-script-coord@w3.org>
- Cc: Norbert Lindenberg <ecmascript@lindenbergsoftware.com>
Why do Web IDL and XMLHttpRequest need ByteString [1, 2]? And why does ByteString have a conversion to/from ECMAScript strings that assumes ISO 8859-1 [3]? If I understand the previous discussion [4] correctly, XMLHttpRequest needs a way to communicate byte sequences that occur in HTTP status messages or headers for which HTTPbis doesn't specify a character encoding anymore, and for which XMLHttpRequest doesn't determine the character encoding either. For such byte sequences, ArrayBuffer or UInt8Array seem well suited, in particular since the proposed Encoding API [5, 6] uses them. A default conversion using ISO 8859-1 seems misguided - in general, today's web standards are not shy about recommending UTF-8. Such a default conversion might have made sense in the past when ECMAScript strings were the only containers available for compact binary data, and all kinds of binary data processing used them, including character encoding conversion, but such hacks should no longer be necessary. HTTP method and header names, BTW, are clearly specified as containing only ASCII characters [7, 8], and so can be represented as DOMString, with exceptions if the strings contain any non-ASCII characters. [1] http://dev.w3.org/2006/webapi/WebIDL/#idl-ByteString [2] http://xhr.spec.whatwg.org/#interface-xmlhttprequest [3] http://dev.w3.org/2006/webapi/WebIDL/#es-ByteString [4] http://lists.w3.org/Archives/Public/public-webapps/2012JanMar/thread.html#msg1273 [5] http://encoding.spec.whatwg.org/#interface-textdecoder [6] http://encoding.spec.whatwg.org/#interface-textencoder [7] http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-22#section-3.1.1 [8] http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-22#section-3.2 Norbert
Received on Wednesday, 10 July 2013 03:59:07 UTC