<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>24845</bug_id>
          
          <creation_ts>2014-02-27 22:53:00 +0000</creation_ts>
          <short_desc>Merge &lt;form&gt; and URL error modes?</short_desc>
          <delta_ts>2014-04-11 10:54:23 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>Encoding</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Ian &apos;Hixie&apos; Hickson">ian</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>hsivonen</cc>
    
    <cc>mike</cc>
    
    <cc>www-international</cc>
    
    <cc>xn--mlform-iua</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>sideshowbarker+encodingspec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>101551</commentid>
    <comment_count>0</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-02-27 22:53:00 +0000</bug_when>
    <thetext>http://encoding.spec.whatwg.org/#encodings

# Otherwise, if encoder&apos;s error handling mode is URL, emit byte 0x3F.

As far as I can tell, Chrome and Safari actually do the same for the URL mode as they do in the &lt;form&gt; mode. (I didn&apos;t check IE. Firefox goes back and reserialises the whole segment using UTF-8 instead.)

e.g.: http://damowmow.com/playground/tests/urls/001.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>101615</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-02-28 14:32:37 +0000</bug_when>
    <thetext>IE will send a literal ? whereas per spec the ? should be percent-encoded IIRC.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102703</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-03-20 13:43:52 +0000</bug_when>
    <thetext>Henri, what do you think? How do you want to align Gecko? Making the error handling the same is certainly attractive.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103260</commentid>
    <comment_count>3</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2014-04-02 07:47:53 +0000</bug_when>
    <thetext>(In reply to Anne from comment #2)
&gt; Henri, what do you think? How do you want to align Gecko? Making the error
&gt; handling the same is certainly attractive.

I think I don&apos;t have enough familiarity with this issues to respond in an informed way. Moreover, I don&apos;t find the sentence that Hixie quoted in the spec to figure out the context of the question.

I might be able to develop an opinion if I knew what case exactly we are talking about here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103270</commentid>
    <comment_count>4</comment_count>
    <who name="Simon Pieters">zcorpan</who>
    <bug_when>2014-04-02 10:01:18 +0000</bug_when>
    <thetext>There are two cases which currently are handled differently in the spec:

Consider a document (with a http: base URL) with encoding windows-1251 which includes a link &lt;a href=&quot;?&amp;aring;&quot;&gt; and a form &lt;form&gt;&lt;input name=x value=&quot;&amp;aring;&quot;&gt;&lt;/form&gt;. å is not representable in windows-1251. The former is turned into ?%3F and the latter is turned into ?%26%23229%3B. The proposal is to make both ?%26%23229%3B.

The proposal matches WebKit/Blink.

IE almost matches the current spec, it just doesn&apos;t percent-escape the &quot;?&quot;.

Gecko switches to utf-8 for the whole URL and gets ?%C3%A5.

I think the &lt;form&gt; handling is interoperable already.

I think the relevant part of the spec is http://encoding.spec.whatwg.org/#concept-encoding-process</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103339</commentid>
    <comment_count>5</comment_count>
    <who name="Henri Sivonen">hsivonen</who>
    <bug_when>2014-04-03 13:02:25 +0000</bug_when>
    <thetext>(In reply to Simon Pieters from comment #4)
&gt; Consider a document (with a http: base URL) with encoding windows-1251 which
&gt; includes a link &lt;a href=&quot;?&amp;aring;&quot;&gt; and a form &lt;form&gt;&lt;input name=x
&gt; value=&quot;&amp;aring;&quot;&gt;&lt;/form&gt;. å is not representable in windows-1251. The former
&gt; is turned into ?%3F and the latter is turned into ?%26%23229%3B. The
&gt; proposal is to make both ?%26%23229%3B.
&gt; 
&gt; The proposal matches WebKit/Blink.
&gt; 
&gt; IE almost matches the current spec, it just doesn&apos;t percent-escape the &quot;?&quot;.

I could live with matching WebKit/Blink. The probability of IE&apos;s approach ever leading to a useful URL seems low.

&gt; Gecko switches to utf-8 for the whole URL and gets ?%C3%A5.

Hmm. Switching the encoding when one non-representable character is added doesn&apos;t seem like a good idea to me, especially if other browsers don&apos;t do the same. CCing bz in the hope of getting background info.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103358</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2014-04-03 14:46:28 +0000</bug_when>
    <thetext>I don&apos;t recall exactly what necko does in this situation and why...  Worth checking with one of the current necko peers.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103392</commentid>
    <comment_count>7</comment_count>
    <who name="Leif Halvard Silli">xn--mlform-iua</who>
    <bug_when>2014-04-04 05:16:33 +0000</bug_when>
    <thetext>(In reply to Henri Sivonen from comment #5)
&gt; (In reply to Simon Pieters from comment #4)

&gt; &gt; Gecko switches to utf-8 for the whole URL and gets ?%C3%A5.
&gt; 
&gt; Hmm. Switching the encoding when one non-representable character is added
&gt; doesn&apos;t seem like a good idea to me, especially if other browsers don&apos;t do
&gt; the same. CCing bz in the hope of getting background info.

Well, compared with what they do for erroneous URLs with *representable* characters, then both Firefox and Webki/Blink switch the encoding when one  non-representable character is added. They just do it different ways.

Firefox just follows the normal procedure of representing code points higher than U+009F as UTF-8 percent-encoded characters. Webkit/BLink do the same - but only for the *representable* characters.

The issue here is, I guess, &apos;storing&apos;: The percent-encoding is decoded e.g. when storing a form.  And so, in Webkit/Blink, ?%26%23229%3B becomes ?&amp;#229;, which is compatible even with Cyrillic encodings.

For IE, the character is stored as representable, and therefore wrong, character.

For Firefox, unless it performs some extra encoding step after the decoding, the percent-encoded character is probably stored as UTF-8 encoded characters read through a non-UTF parser

For storing a form, the Webkit/Blink behavior seems more fruitful. Inside a Web page, the Firefox method might be better?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103667</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-04-10 11:36:12 +0000</bug_when>
    <thetext>I asked Necko guys before (just checked again on #necko, no response so far) and I believe nobody in charge at the moment really knows much or cares for the URL parsing code.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>103732</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-04-11 10:54:23 +0000</bug_when>
    <thetext>https://github.com/whatwg/encoding/commit/73874f405d64a061eee35f4211cb3fe1e903a934</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>