spec/Overview.html 1.1495 2322 WF2: Form submission encoding algorithms

WF2: Form submission encoding algorithms and related fallout. Also,
change 'int' to 'long' in IDL blocks. (whatwg r2322)

4.10.15.1 URL-encoded form data
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#url-encoded-form-data
WebSocket
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#websocket
SQLError
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#sqlerror
Abstract
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#abstract
SQLResultSet
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#sqlresultset
Mail as body
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#submit-mailto-body
Submit as entity body
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#submit-body
4.10.16 Resetting a form
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#resetting-a-form
HTMLInputElement
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#htmlinputelement
Index
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#index
5.10.2.5 Errors
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#errors
appropriate form encoding algorithm
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#appropriate-form-encoding-algorithm
Mutate action
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#submit-mutate-action
insertId
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#dom-sqlresultset-insertid
5.10.2.4 Database query results
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#database-query-results
4.10.15.3 Plain text form data
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#plain-text-form-data
TextMetrics
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#textmetrics
Constructing the form data set. For each element field in controls, in tree order, run the following substeps: If any of the following conditions are met, then skip these substeps for this element: The field element has a datalist element ancestor. The field element is disabled. The field element is a button but it is not submitter. The field element is an input element whose type attribute is in the Checkbox state and whose checkedness is false. The field element is an input element whose type attribute is in the Radio Button state and whose checkedness is false. The field element is an input element whose type attribute is in the File Upload state but the control does not have any files selected. Otherwise, process field as follows: Let type be the value of the type DOM attribute of field. If the field element is an input element whose type attribute is in the Image Button state, then run these further nested substeps: If the field element has an name attribute specified and value is not the empty string,let name be that value followed by a single U+002E FULL STOP (.) character. Otherwise, let name be the empty string. Let namex be the string consisting of the concatenation of name and a single U+0078 LATIN SMALL LETTER X (x) character. Let namey be the string consisting of the concatenation of name and a single U+0079 LATIN SMALL LETTER Y (y) character. The field element is submitter, and before this algorithm was invoked the user indicated a coordinate. Let x be the x-component of the coordindate selected by the user, and let y be the y-component of the coordinate selected by the user. Append an entry in the form data set with the name namex, the value x, and the type type. Append an entry in the form data set with the name namey and the value y, and the type type. Skip the remaining substeps for this element: if there are any more elements in controls, return to the top of the constructing the form data set step, otherwise, jump to the next step in the overall form submission algorithm. If the field elemnt does not have a name attribute specified, or its name attribute's value is the empty string, skip these substeps for this element: if there are any more elements in controls, return to the top of the constructing the form data set step, otherwise, jump to the next step in the overall form submission algorithm. Let name be the value of the field element's name attribute. If the field element is a select element, then for each option element in the select element whose selectedness is true, append an entry in the form data set with the name as the name, the value of the option element as the value, and type as the type. Otherwise, if the field element is an input element whose type attribute is in the Checkbox state or the Radio Button state, then then run these further nested substeps: If the field element has a value attribute specified, then let value be the value of that attribute; otherwise, let value be the string "on". Append an entry in the form data set with name as the name, value as the value, ad type as the type. Otherwise, if the field element is an input element whose type attribute is in the File Upload state, then for each file selected in the input element, append an entry in the form data set with the name as the name, the file (consisting of the name, the type, and the body) as the value, and type as the type. Otherwise, append an entry in the form data set with name as the name, the value of the field element as the value, and type as the type.
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#constructing-form-data-set
If form is in a Document that has no associated browsing context or whose browsing context has its sandboxed forms browsing context flag set, then abort these steps without doing anything.
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#sandboxSubmitBlocked
4.10.15.2 Multipart form data
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#multipart-form-data
code
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#dom-sqlerror-code
Status of this document
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#status-of-this-document
ImageData
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#imagedata
A start tag whose tag name is "isindex"
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#isindex
A vocabulary and associated APIs for HTML and XHTML
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#a-vocabulary-and-associated-apis-for-html-and-xhtml
Post to data:
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#submit-data-post
item(index)
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#dom-sqlresultsetrowlist-item
Mail with headers
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#submit-mailto-headers
Editor's Draft 11 October 2008
http://people.w3.org/mike/diffs/html5/spec/Overview.1.1495.html#editor-s-draft-date-zzz-9-june-2008

http://people.w3.org/mike/diffs/html5/spec/Overview.diff.html
http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.1494&r2=1.1495&f=h
http://html5.org/tools/web-apps-tracker?from=2321&to=2322

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.1494
retrieving revision 1.1495
diff -u -d -r1.1494 -r1.1495
--- Overview.html 10 Oct 2008 04:32:37 -0000 1.1494
+++ Overview.html 11 Oct 2008 01:37:44 -0000 1.1495
@@ -8,7 +8,7 @@
    <p><a href=http://www.w3.org/><img alt=W3C height=48 src=http://www.w3.org/Icons/w3c_home width=72></a></p>
    <h1>HTML 5</h1>
    <h2 class="no-num no-toc" id=a-vocabulary-and-associated-apis-for-html-and-xhtml>A vocabulary and associated APIs for HTML and XHTML</h2>
-   <h2 class="no-num no-toc" id=editor-s-draft-date-zzz-9-june-2008><!-- "W3C Working Draft" --> Editor's Draft <!--ZZZ-->10 October 2008</h2>
+   <h2 class="no-num no-toc" id=editor-s-draft-date-zzz-9-june-2008><!-- "W3C Working Draft" --> Editor's Draft <!--ZZZ-->11 October 2008</h2>
    <dl><!-- ZZZ: update the month/day
     <dt>This Version:</dt>
     <dd><a href="http://www.w3.org/TR/2008/WD-html5-20080610/">http://www.w3.org/TR/2008/WD-html5-20080610/</a></dd>
@@ -33,13 +33,6 @@
    <a href=http://www.w3.org/Consortium/Legal/ipr-notice#W3C_Trademarks>trademark</a>
    and <a href=http://www.w3.org/Consortium/Legal/copyright-documents>document
    use</a> rules apply.</p>
-
-   <!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST -->
-   <p class="alt copyright">The <a href=http://www.whatwg.org/specs/web-apps/current-work/>WHATWG
-   version</a> of this specification is available under a license that
-   permits reuse of the specification text.</p>
-   <!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST -->
-
   </div><hr><h2 class="no-num no-toc" id=abstract>Abstract</h2><p>This specification defines the 5th major revision of the core
   language of the World Wide Web: the Hypertext Markup Language
   (HTML). In this version, new features are introduced to help Web
@@ -51,7 +44,11 @@
   document. A list of current W3C publications and the most recently
   formally published revision of this technical report can be found in
   the <a href=http://www.w3.org/TR/>W3C technical reports index</a>
-  at http://www.w3.org/TR/.</em></p><!-- where to send feedback (required) --><p>If you wish to make comments regarding this document, please send
+  at http://www.w3.org/TR/.</em></p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- XXX this section will be moved back to just below the copyright
+  notice in the header by October 2009 unless the spec as a whole has
+  been transitioned to a more permissive license by that time. --><!-- XXX when moving this text, add: class="alt copyright" --><p>The <a href=http://www.whatwg.org/specs/web-apps/current-work/>WHATWG
+  version</a> of this specification is available under a license that
+  permits reuse of the specification text.</p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- where to send feedback (required) --><p>If you wish to make comments regarding this document, please send
   them to <a href=mailto:public-html-comments@w3.org>public-html-comments@w3.org</a>
   (<a href="mailto:public-html-comments-request@w3.org?subject=subscribe">subscribe</a>,
   <a href=http://lists.w3.org/Archives/Public/public-html-comments/>archives</a>)
@@ -100,7 +97,7 @@
   specification's progress along the W3C Recommendation
   track.
   <!--ZZZ:-->
-  This specification is the 10 October 2008 <!--ZZZ "Working Draft"-->Editor's Draft.
+  This specification is the 11 October 2008 <!--ZZZ "Working Draft"-->Editor's Draft.
   <!--:ZZZ-->
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>This specification is also being produced by the <a href=http://www.whatwg.org/>WHATWG</a>. The two specifications are
   identical from the table of contents onwards.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- context and rationale (required) --><p>This specification is intended to replace (be a new version of)
@@ -15111,8 +15108,8 @@
 };
 
 interface <dfn id=imagedata>ImageData</dfn> {
-  readonly attribute unsigned long int <a href=#dom-imagedata-width title=dom-imagedata-width>width</a>;
-  readonly attribute unsigned long int <a href=#dom-imagedata-height title=dom-imagedata-height>height</a>;
+  readonly attribute unsigned long <a href=#dom-imagedata-width title=dom-imagedata-width>width</a>;
+  readonly attribute unsigned long <a href=#dom-imagedata-height title=dom-imagedata-height>height</a>;
   readonly attribute <a href=#canvaspixelarray>CanvasPixelArray</a> <a href=#dom-imagedata-data title=dom-imagedata-data>data</a>;
 };
 
@@ -18638,8 +18635,8 @@
            attribute float <a href=#dom-input-valueasnumber title=dom-input-valueAsNumber>valueAsNumber</a>;
   readonly attribute <a href=#htmloptionelement>HTMLOptionElement</a> <a href=#dom-input-selectedoption title=dom-input-selectedOption>selectedOption</a>;
 
-  void <a href=#dom-input-stepup title=dom-input-stepUp>stepUp</a>(in int n);
-  void <a href=#dom-input-stepdown title=dom-input-stepDown>stepDown</a>(in int n);
+  void <a href=#dom-input-stepup title=dom-input-stepUp>stepUp</a>(in long n);
+  void <a href=#dom-input-stepdown title=dom-input-stepDown>stepDown</a>(in long n);
 
   readonly attribute boolean <a href=#dom-cva-willvalidate title=dom-cva-willValidate>willValidate</a>;
   readonly attribute <a href=#validitystate>ValidityState</a> <a href=#dom-cva-validity title=dom-cva-validity>validity</a>;
@@ -22263,7 +22260,7 @@
    order</a>.</li>
 
    <li><p>Let the <var title="">form data set</var> be a list of
-   name/value pairs, initially empty.</li>
+   name-value-type tuples, initially empty.</li>
 
    <li id=constructing-form-data-set>
 
@@ -22301,6 +22298,8 @@
 
      </li>
 
+     <li><p>Let <var title="">type</var> be the value of the <code title="">type</code> DOM attribute of <var title="">field</var>.</li>
+
      <li>
 
       <p>If the <var title="">field</var> element is an
@@ -22328,12 +22327,12 @@
        user.</li>
 
        <li><p>Append an entry in the <var title="">form data set</var>
-       with the name <var title="">name<sub title="">x</sub></var> and
-       the value <var title="">x</var>.</li>
+       with the name <var title="">name<sub title="">x</sub></var>,
+       the value <var title="">x</var>, and the type <var title="">type</var>.</li>
 
        <li><p>Append an entry in the <var title="">form data set</var>
        with the name <var title="">name<sub title="">y</sub></var> and
-       the value <var title="">y</var>.</li>
+       the value <var title="">y</var>, and the type <var title="">type</var>.</li>
 
        <li><p>Skip the remaining substeps for this element: if there
        are any more elements in <var title="">controls</var>, return
@@ -22358,8 +22357,8 @@
      <code><a href=#the-select-element>select</a></code> element, then for each <code><a href=#the-option-element>option</a></code>
      element in the <code><a href=#the-select-element>select</a></code> element whose <a href=#concept-option-selectedness title=concept-option-selectedness>selectedness</a> is true,
      append an entry in the <var title="">form data set</var> with the
-     <var title="">name</var> as the name and the <a href=#concept-option-value title=concept-option-value>value</a> of the
-     <code><a href=#the-option-element>option</a></code> element as the value.</li>
+     <var title="">name</var> as the name, the <a href=#concept-option-value title=concept-option-value>value</a> of the
+     <code><a href=#the-option-element>option</a></code> element as the value, and <var title="">type</var> as the type.</li>
 
      <li>
 
@@ -22374,7 +22373,8 @@
        "<code title="">on</code>".</li>
 
        <li><p>Append an entry in the <var title="">form data set</var>
-       with <var title="">name</var> as the name and <var title="">value</var> as the value.</li>
+       with <var title="">name</var> as the name, <var title="">value</var> as the value, and <var title="">type</var>
+       as the type.</li>
 
       </ol></li>
 
@@ -22382,11 +22382,12 @@
      <code><a href=#the-input-element>input</a></code> element whose <code title=attr-input-type><a href=#attr-input-type>type</a></code> attribute is in the <a href=#file-upload-state title=attr-input-type-file>File Upload</a> state, then for
      each file <a href=#concept-input-type-file-selected title=concept-input-type-file-selected>selected</a> in the
      <code><a href=#the-input-element>input</a></code> element, append an entry in the <var title="">form data set</var> with the <var title="">name</var> as
-     the name and the file (consisting of the name, the type, and the
-     body) as the value.</li>
+     the name, the file (consisting of the name, the type, and the
+     body) as the value, and <var title="">type</var> as the
+     type.</li>
 
      <li><p>Otherwise, append an entry in the <var title="">form data
-     set</var> with <var title="">name</var> as the name and the <a href=#concept-fe-value title=concept-fe-value>value</a> of the <var title="">field</var> element as the value.</li>
+     set</var> with <var title="">name</var> as the name, the <a href=#concept-fe-value title=concept-fe-value>value</a> of the <var title="">field</var> element as the value, and <var title="">type</var> as the type.</li>
 
     </ol></li>
 
@@ -22466,9 +22467,9 @@
     <dl><dt><dfn id=submit-mutate-action title=submit-mutate-action>Mutate action</dfn>
      <dd>
 
-      <p>Let <var title="">query</var> be the resulting encoding the
+      <p>Let <var title="">query</var> be the result of encoding the
       <var title="">form data set</var> using the <a href=#application-x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
-      algorithm</a>.</p>
+      algorithm</a>, interpreted as a US-ASCII string.</p>
 
       <p>Let <var title="">destination</var> be a new <a href=#url>URL</a>
       that is equal to the <var title="">action</var> except that its
@@ -22496,11 +22497,27 @@
       <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
       form submission target browsing context</a>.</p>
 
-      <p><a href=#navigate>Navigate</a> <var title="">target browsing
+      <p>Let <var title="">MIME type</var> be determined as
+      follows:</p>
+
+      <dl><dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-urlencoded><a href=#attr-fs-enctype-urlencoded>application/x-www-form-urlencoded</a></code></dt>
+
+       <dd>Let <var title="">MIME type</var> be "<code title="">application/x-www-form-urlencoded</code>".</dd>
+
+       <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-formdata><a href=#attr-fs-enctype-formdata>multpart/form-data</a></code></dt>
+
+       <dd>Let <var title="">MIME type</var> be "<code title="">multipart/form-data</code>".</dd>
+
+       <dt>If <var title="">enctype</var> is <code title=attr-fs-enctype-text><a href=#attr-fs-enctype-text>text/plain</a></code></dt>
+
+       <dd>Let <var title="">MIME type</var> be "<code title="">text/plain</code>".</dd>
+
+      </dl><p><a href=#navigate>Navigate</a> <var title="">target browsing
       context</var> to <var title="">action</var> using the HTTP
-      method given by <var title="">method</var> and with <var title="">entity body</var> as the entity body. If <var title="">target browsing context</var> was newly created for
-      this purpose by the steps above, then it must be navigated with
-      <a href=#replacement-enabled>replacement enabled</a>.</p>
+      method given by <var title="">method</var> and with <var title="">entity body</var> as the entity body, of type <var title="">MIME type</var>. If <var title="">target browsing
+      context</var> was newly created for this purpose by the steps
+      above, then it must be navigated with <a href=#replacement-enabled>replacement
+      enabled</a>.</p>
 
      </dd>
 
@@ -22539,18 +22556,20 @@
       form encoding algorithm</a>.</p>
 
       <p>If <var title="">action</var> contains the string "<code title="">%%%%</code>" (four U+0025 PERCENT SIGN characters),
-      then %-escape all characters in <var title="">data</var> that do
-      not match the <code title="">unreserved</code> production in the
-      URI Generic Syntax, and then further %-escape all the U+0025
-      PERCENT SIGN characters in the resulting string, and replace the
-      first occurance of "<code title="">%%%%</code>" in <var title="">action</var> with the resulting double-escaped
-      string. <a href=#references>[RFC3986]</a></p>
+      then %-escape all bytes in <var title="">data</var> that, if
+      interpreted as US-ASCII, do not match the <code title="">unreserved</code> production in the URI Generic Syntax,
+      and then, treating the result as a US-ASCII string, further
+      %-escape all the U+0025 PERCENT SIGN characters in the resulting
+      string and replace the first occurance of "<code title="">%%%%</code>" in <var title="">action</var> with the
+      resulting double-escaped string. <a href=#references>[RFC3986]</a></p>
 
       <p>Otherwise, if <var title="">action</var> contains the string
       "<code title="">%%</code>" (two U+0025 PERCENT SIGN characters
-      in a row, but not four), then %-escape all characters in <var title="">data</var> that do not match the <code title="">unreserved</code> production in the URI Generic Syntax,
-      and replace the first occurance of "<code title="">%%</code>" in
-      <var title="">action</var> with the resulting escaped string. <a href=#references>[RFC3986]</a></p>
+      in a row, but not four), then %-escape all characters in <var title="">data</var> that, if interpreted as US-ASCII, do not
+      match the <code title="">unreserved</code> production in the URI
+      Generic Syntax, and then, treating the result as a US-ASCII
+      string, replace the first occurance of "<code title="">%%</code>" in <var title="">action</var> with the
+      resulting escaped string. <a href=#references>[RFC3986]</a></p>
 
       <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
       form submission target browsing context</a>.</p>
@@ -22611,7 +22630,7 @@
 
       <p>Let <var title="">headers</var> be the resulting encoding the
       <var title="">form data set</var> using the <a href=#application-x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
-      algorithm</a>.</p>
+      algorithm</a>, interpreted as a US-ASCII string.</p>
 
       <p>Replace occurances of U+002B PLUS SIGN characters (+) in <var title="">headers</var> with the string "<code title="">%20</code>".</p>
 
@@ -22639,9 +22658,10 @@
 
       <p>Let <var title="">body</var> be the resulting encoding the
       <var title="">form data set</var> using the <a href=#appropriate-form-encoding-algorithm>appropriate
-      form encoding algorithm</a> and then %-escaping all the
-      characters in the resulting string that do not match the <code title="">unreserved</code> production in the URI Generic
-      Syntax. <a href=#references>[RFC3986]</a></p>
+      form encoding algorithm</a> and then %-escaping all the bytes
+      in the resulting byte string that, when interpreted as US-ASCII,
+      do not match the <code title="">unreserved</code> production in
+      the URI Generic Syntax. <a href=#references>[RFC3986]</a></p>
       
       <p>Let <var title="">destination</var> have the same value as
       <var title="">action</var>.</p>
@@ -22653,7 +22673,8 @@
 
       <p>Append the string "<code title="">body=</code>" to <var title="">destination</var>.</p>
 
-      <p>Append <var title="">body</var> to <var title="">destination</var>.</p>
+      <p>Append <var title="">body</var>, interpreted as a US-ASCII
+      string, to <var title="">destination</var>.</p>
 
       <p>Let <var title="">target browsing context</var> be <a href=#the-form-submission-target-browsing-context>the
       form submission target browsing context</a>.</p>
@@ -22697,25 +22718,148 @@
     </dl></li>
 
   </ol><h5 id=url-encoded-form-data><span class=secno>4.10.15.1 </span>URL-encoded form data</h5><p>The <dfn id=application-x-www-form-urlencoded-encoding-algorithm><code title="">application/x-www-form-urlencoded</code> encoding
-  algorithm</dfn> is as follows:<ol><li><p class=XXX>...</li>
+  algorithm</dfn> is as follows:<ol><li><p>Let <var title="">result</var> be the empty string.</li>
 
-   <!-- During this step, the form data set is examined to ensure all
-   the characters are representable in the submission character
-   encoding. -->
+   <li>
+
+    <p>If the <code><a href=#the-form-element>form</a></code> element has an <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute,
+    then, taking into account the characters found in the <var title="">form data set</var>'s names and values, and the character
+    encodings supported by the user agent, select a character encoding
+    from the list given in the <code><a href=#the-form-element>form</a></code>'s <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute
+    that is an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>. If
+    none of the encodings are supported, then let the selected
+    character encoding be UTF-8.</p>
+
+    <p>Otherwise, if the <a href=#document-s-character-encoding>document's character encoding</a> is
+    an <a href=#ascii-compatible-character-encoding>ASCII-compatible character encoding</a>, then that is
+    the selected character encoding.</p>
+
+    <p>Otherwise, let the selected character encoding be UTF-8.</p>
+
+   </li>
+
+   <li><p>Let <var title="">charset</var> be the preferred MIME name
+   of the selected character encoding.</li>
+
+   <li><p>If the entry's name is "<code title="">_charset_</code>" and
+   its type is "<code title="">hidden</code>", replace its value with
+   <var title="">charset</var>.</li>
+
+   <li><p>If the entry's type is "<code title="">file</code>", replace
+   its value with the file's filename only.</li>
+
+   <li>
+
+    <p>For each entry in the <var title="">form data set</var>,
+    perform these substeps:</p>
+
+    <ol><li><p>For each character in the entry's name and value that
+     cannot be expressed using the selected character encoding,
+     replace the character by a string consisting of a U+0026
+     AMPERSAND character (&amp;), one of more characters in the range
+     U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9) representing the
+     Unicode codepoint of the character in base ten, and finally a
+     U+003B SEMICOLON character (;).</li>
+
+     <li>
+
+      <p>For each character in the entry's name and value, apply the
+      following subsubsteps:</p>
+
+      <ol><!-- * - . _ 0-9 a-z A-Z --><li><p>If the character isn't in the range U+0020, U+002A,
+       U+002D, U+002E, U+0030 .. U+0039, U+0041 .. U+005A, U+005F,
+       U+0061 .. U+007A then replace the character with a string
+       formed as follows: Start with the empty string, and then,
+       taking each byte of the character when expressed in the
+       selected character encoding in turn, append to the string a
+       U+0025 PERCENT SIGN character (%) followed by two characters in
+       the ranges U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9) and
+       U+0041 LATIN CAPITAL LETTER A to U+005A LATIN CAPITAL LETTER Z
+       representing the hexadecimal value of the byte (zero-padded if
+       necessary).</li>
+
+       <li><p>If the character is a U+0020 SPACE character, replace it
+       with a single U+002B PLUS SIGN character (+).</li>
+
+      </ol></li>
+
+     <li><p>If the entry's name is "<code title="">isindex</code>",
+     its type is "<code title="">text</code>", and this is the first
+     entry in the <var title="">form data set</var>, then append the
+     value to <var title="">result</var> and skip the rest of the
+     substeps for this entry, moving on to the next entry, if any, or
+     the next step in the overall algorithm otherwise.</li>
+
+     <li><p>If this is not the first entry, append a single U+0026
+     AMPERSAND character (&amp;) to <var title="">result</var>.</li>
+
+     <li><p>Append the entry's name to <var title="">result</var>.</li>
+
+     <li><p>Append a single U+003D EQUALS SIGN character (=) to <var title="">result</var>.</li>
+
+     <li><p>Append the entry's value to <var title="">result</var>.</li>
+
+    </ol></li>
+
+   <li><p>Encode <var title="">result</var> as US-ASCII and return the
+   resulting byte stream.</li>
 
   </ol><h5 id=multipart-form-data><span class=secno>4.10.15.2 </span>Multipart form data</h5><p>The <dfn id=multipart-form-data-encoding-algorithm><code title="">multipart/form-data</code> encoding
-  algorithm</dfn> is as follows:<ol><li><p class=XXX>...</li>
+  algorithm</dfn> is to encode the <var title="">form data set</var>
+  using the rules described by RFC2388, <cite>Returning Values from
+  Forms: <code title="">multipart/form-data</code></cite>, and return
+  the resulting byte stream. <a href=#references>[RFC2388]</a><p>Each entry in the <var title="">form data set</var> is a
+  <i>field</i>, the name of the entry is the <i>field name</i> and the
+  value of the entry is the <i>field value</i>.<p>The order of parts must be the same as the order of fields in the
+  <var title="">form data set</var>. Multiple entries with the same
+  name must be treated as distinct fields.</p><!-- XXX define default encoding? --><h5 id=plain-text-form-data><span class=secno>4.10.15.3 </span>Plain text form data</h5><p>The <dfn id=text-plain-encoding-algorithm><code title="">text/plain</code> encoding
+  algorithm</dfn> is as follows:<ol><li><p>Let <var title="">result</var> be the empty string.</li>
 
-   <!-- During this step, the form data set is examined to ensure all
-   the characters are representable in the submission character
-   encoding. -->
+   <li>
 
-  </ol><h5 id=plain-text-form-data><span class=secno>4.10.15.3 </span>Plain text form data</h5><p>The <dfn id=text-plain-encoding-algorithm><code title="">text/plain</code> encoding
-  algorithm</dfn> is as follows:<ol><li><p class=XXX>...</li>
+    <!-- this is different from application/x-www-form-urlencoded in
+    that it isn't limited to ASCII-compatible encodings -->
 
-   <!-- During this step, the form data set is examined to ensure all
-   the characters are representable in the submission character
-   encoding. -->
+    <p>If the <code><a href=#the-form-element>form</a></code> element has an <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code> attribute,
+    then, taking into account the characters found in the <var title="">form data set</var>'s names and values, and the character
+    encodings supported by the user agent, select a character encoding
+    from the list given in the <code><a href=#the-form-element>form</a></code>'s <code title=attr-form-accept-charset><a href=#attr-form-accept-charset>accept-charset</a></code>
+    attribute. If none of the encodings are supported, then let the
+    selected character encoding be UTF-8.</p>
+
+    <p>Otherwise, the selected character encoding is the
+    <a href=#document-s-character-encoding>document's character encoding</a>.</p>
+
+   </li>
+
+   <li><p>Let <var title="">charset</var> be the preferred MIME name
+   of the selected character encoding.</li>
+
+   <li><p>If the entry's name is "<code title="">_charset_</code>" and
+   its type is "<code title="">hidden</code>", replace its value with
+   <var title="">charset</var>.</li>
+
+   <li><p>If the entry's type is "<code title="">file</code>", replace
+   its value with the file's filename only.</li>
+
+   <li>
+
+    <p>For each entry in the <var title="">form data set</var>,
+    perform these substeps:</p>
+
+    <ol><li><p>Append the entry's name to <var title="">result</var>.</li>
+
+     <li><p>Append a single U+003D EQUALS SIGN character (=) to <var title="">result</var>.</li>
+
+     <li><p>Append the entry's value to <var title="">result</var>.</li>
+
+     <li><p>Append a U+000D CARRIAGE RETURN (CR) U+000A LINE FEED (LF)
+     character pair to <var title="">result</var>.</li>
+
+    </ol></li>
+
+   <li><p>Encode <var title="">result</var> using the selected
+   character encoding and return the resulting byte stream.</li>
 
   </ol><h4 id=resetting-a-form><span class=secno>4.10.16 </span>Resetting a form</h4><p>When a form <var title="">form</var> is <dfn id=concept-form-reset title=concept-form-reset>reset</dfn>, the user agent must invoke
   the <a href=#concept-form-reset-control title=concept-form-reset-control>reset algorithm</a>
@@ -29613,8 +29757,8 @@
   define the exact SQL subset required in more detail.<h5 id=database-query-results><span class=secno>5.10.2.4 </span>Database query results</h5><p>The <code title=dom-transaction-executeSql>executeSql()</code>
   method invokes its callback with a <code><a href=#sqlresultset>SQLResultSet</a></code> object
   as an argument.<pre class=idl>interface <dfn id=sqlresultset>SQLResultSet</dfn> {
-  readonly attribute int <a href=#dom-sqlresultset-insertid title=dom-SQLResultSet-insertId>insertId</a>;
-  readonly attribute int <a href=#dom-sqlresultset-rowsaffected title=dom-SQLResultSet-rowsAffected>rowsAffected</a>;
+  readonly attribute long <a href=#dom-sqlresultset-insertid title=dom-SQLResultSet-insertId>insertId</a>;
+  readonly attribute long <a href=#dom-sqlresultset-rowsaffected title=dom-SQLResultSet-rowsAffected>rowsAffected</a>;
   readonly attribute <a href=#sqlresultsetrowlist>SQLResultSetRowList</a> <a href=#dom-sqlresultset-rows title=dom-SQLResultSet-rows>rows</a>;
 };</pre><p>The <dfn id=dom-sqlresultset-insertid title=dom-SQLResultSet-insertId><code>insertId</code></dfn>
   attribute must return the row ID of the row that the
@@ -29647,7 +29791,7 @@
   name of the column and the value of the cell, as they were returned
   by the database.<h5 id=errors><span class=secno>5.10.2.5 </span>Errors</h5><p>Errors in the database API are reported using callbacks that have
   a <code><a href=#sqlerror>SQLError</a></code> object as one of their arguments.<pre class=idl>interface <dfn id=sqlerror>SQLError</dfn> {
-  readonly attribute unsigned int <a href=#dom-sqlerror-code title=dom-SQLError-code>code</a>;
+  readonly attribute unsigned long <a href=#dom-sqlerror-code title=dom-SQLError-code>code</a>;
   readonly attribute DOMString <a href=#dom-sqlerror-message title=dom-SQLError-message>message</a>;
 };</pre><p>The <dfn id=dom-sqlerror-code title=dom-SQLError-code><code>code</code></dfn> DOM
   attribute must return the most appropriate code from the following
@@ -33010,7 +33154,7 @@
   const unsigned short <a href=#dom-websocket-connecting title=dom-WebSocket-CONNECTING>CONNECTING</a> = 0;
   const unsigned short <a href=#dom-websocket-open title=dom-WebSocket-OPEN>OPEN</a> = 1;
   const unsigned short <a href=#dom-websocket-closed title=dom-WebSocket-CLOSED>CLOSED</a> = 2;
-  readonly attribute int <a href=#dom-websocket-readystate title=dom-WebSocket-readyState>readyState</a>;
+  readonly attribute long <a href=#dom-websocket-readystate title=dom-WebSocket-readyState>readyState</a>;
 
   // networking
            attribute EventListener <a href=#handler-websocket-onopen title=handler-WebSocket-onopen>onopen</a>;
@@ -38473,11 +38617,6 @@
     keywords here: (input field)" in the user's preferred
     language.</p>
 
-    <p class=XXX> Then need to specify that if the form
-    submission causes just a single form control, whose name is
-    "isindex", to be submitted, then we submit just the value part,
-    not the "isindex=" part.  </p>
-
    </dd>
 
 <!-- XXX keygen support; don't forget form element pointer!
@@ -43036,7 +43175,6 @@
        ("<code title="">foo</code>" vs <code>foo</code>)
  XXX * need to properly xref events throughout, mark up DOMActivate, etc
  XXX * onclick="" only fires if it is a MouseEvent ?
- XXX * <isindex> needs some prose in the form submission section
  XXX * hsivonen makes the following suggestions:
        > To make document conformance a more useful concept for the purpose of catching
        > author errors, I suggest that the following attributes be made required:

Received on Saturday, 11 October 2008 01:42:50 UTC