hixie: Redefine how we interact with RFC 2388 (multipart/form-data) in submission (whatwg r5600)

hixie: Redefine how we interact with RFC 2388 (multipart/form-data) in
submission (whatwg r5600)

http://dev.w3.org/cvsweb/html5/spec/Overview.html?r1=1.4477&r2=1.4478&f=h
http://html5.org/tools/web-apps-tracker?from=5599&to=5600

===================================================================
RCS file: /sources/public/html5/spec/Overview.html,v
retrieving revision 1.4477
retrieving revision 1.4478
diff -u -d -r1.4477 -r1.4478
--- Overview.html 11 Oct 2010 22:32:40 -0000 1.4477
+++ Overview.html 12 Oct 2010 00:10:26 -0000 1.4478
@@ -316,7 +316,7 @@
 
    <h1>HTML5</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-11-october-2010">Editor's Draft 11 October 2010</h2>
+   <h2 class="no-num no-toc" id="editor-s-draft-12-october-2010">Editor's Draft 12 October 2010</h2>
    <dl><dt>Latest Published Version:</dt>
     <dd><a href="http://www.w3.org/TR/html5/">http://www.w3.org/TR/html5/</a></dd>
     <dt>Latest Editor's Draft:</dt>
@@ -422,7 +422,7 @@
   Group</a> is the W3C working group responsible for this
   specification's progress along the W3C Recommendation
   track.
-  This specification is the 11 October 2010 Editor's Draft.
+  This specification is the 12 October 2010 Editor's Draft.
   </p><!-- UNDER NO CIRCUMSTANCES IS THE PRECEDING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- relationship to other work (required) --><p>Work on this specification is also done at the <a href="http://www.whatwg.org/">WHATWG</a>. The W3C HTML working group
   actively pursues convergence with the WHATWG, as required by the <a href="http://www.w3.org/2007/03/HTML-WG-charter">W3C HTML working
   group charter</a>.</p><!-- UNDER NO CIRCUMSTANCES IS THE FOLLOWING PARAGRAPH TO BE REMOVED OR EDITED WITHOUT TALKING TO IAN FIRST --><!-- required patent boilerplate --><p>This document was produced by a group operating under the <a href="http://www.w3.org/Consortium/Patent-Policy-20040205/">5
@@ -35806,7 +35806,7 @@
   <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:</p>
 
-  <ol><li><p>Let <var title="">result</var> be the empty string.</li>
+  <ol><!-- the first few steps of this are the same as in the next section --><li><p>Let <var title="">result</var> be the empty string.</li>
 
    <li>
 
@@ -35839,7 +35839,8 @@
      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>
+     replace its value with the file's filename only.</li> <!--
+     this is not present in the next section -->
 
      <li><p>For each character in the entry's name and value that
      cannot be expressed using the selected character encoding,
@@ -35849,9 +35850,11 @@
      U+0039 DIGIT NINE (9) representing the Unicode code point of the
      character in base ten, and finally a U+003B SEMICOLON character
      (;).</li><!-- we should say it should be the shortest
-     possible string, no leading zeros. this whole step as asinine,
+     possible string, no leading zeros. this whole step is asinine,
      though, so... -->
 
+     <!-- this is where the similarities with the next section end -->
+
      <li>
 
       <p>For each character in the entry's name and value, apply the
@@ -35931,24 +35934,86 @@
 
   <h5 id="multipart-form-data"><span class="secno">4.10.21.5 </span>Multipart form data</h5>
 
+  <!-- http://hixie.ch/tests/adhoc/html/forms/submission/multipart_form-data/ -->
+
   <p>The <dfn id="multipart-form-data-encoding-algorithm"><code title="">multipart/form-data</code> encoding
-  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="#refsRFC2388">[RFC2388]</a></p>
+  algorithm</dfn> is as follows:</p>
 
-  <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>, unless the entry's
-  name is "<code title="attr-fe-name-charset"><a href="#attr-fe-name-charset">_charset_</a></code>" and its type is "<code title="">hidden</code>", in which case the <i>field value</i> is the
-  character encoding used by the aforementioned algorithm to encode
-  the value of the field.</p>
+  <ol><!-- the first few steps of this are the same as in the previous section --><li><p>Let <var title="">result</var> be the empty string.</li>
 
-  <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>
+   <li>
 
-  </div><div class="impl">
+    <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, or if none are listed, 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 <a href="#preferred-mime-name">preferred MIME
+   name</a> of the selected character encoding.</li>
+
+   <li>
+
+    <p>For each entry in the <var title="">form data set</var>,
+    perform these substeps:</p>
+
+    <ol><li><p>If the entry's name is "<code title="attr-fe-name-charset"><a href="#attr-fe-name-charset">_charset_</a></code>"
+     and its type is "<code title="">hidden</code>", replace its value
+     with <var title="">charset</var>.</li>
+
+     <!-- the step that replaces a file with its name is missing in
+     this version of the algorithm -->
+
+     <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;), a U+0023 NUMBER SIGN character (#),
+     one or more characters in the range U+0030 DIGIT ZERO (0) to
+     U+0039 DIGIT NINE (9) representing the Unicode code point of the
+     character in base ten, and finally a U+003B SEMICOLON character
+     (;).</li><!-- we should say it should be the shortest
+     possible string, no leading zeros. this whole step is asinine,
+     though, so... -->
+
+     <!-- this is where the similarities with the previous section end -->
+
+    </ol></li>
+
+   <li>
+
+    <p>Encode the (now mutated) <var title="">form data set</var>
+    using the rules described by RFC 2388, <cite>Returning Values from
+    Forms: <code title="">multipart/form-data</code></cite>, and
+    return the resulting byte stream. <a href="#refsRFC2388">[RFC2388]</a></p>
+
+    <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>
+
+    <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>
+
+    <p>The parts of the generated <code title="">multipart/form-data</code> resource that correspond to
+    non-file fields must not have a <code><a href="#content-type">Content-Type</a></code> header
+    specified. Their names and values must be encoded using the
+    character encoding selected above (field names in particular do
+    not get converted to a 7-bit safe encoding as suggested in RFC
+    2388).</p>
+
+   </li>
+
+  </ol></div><div class="impl">
 
   <h5 id="plain-text-form-data"><span class="secno">4.10.21.6 </span>Plain text form data</h5>

Received on Tuesday, 12 October 2010 00:11:19 UTC