<?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>24163</bug_id>
          
          <creation_ts>2013-12-23 18:40:40 +0000</creation_ts>
          <short_desc>Unsafe characters should be percent-encoded</short_desc>
          <delta_ts>2015-06-18 09:44:07 +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>URL</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>WORKSFORME</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="Santiago M. Mola">santi</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
    
    <cc>naruse</cc>
    
    <cc>rubys</cc>
          
          <qa_contact>sideshowbarker+urlspec</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>97862</commentid>
    <comment_count>0</comment_count>
    <who name="Santiago M. Mola">santi</who>
    <bug_when>2013-12-23 18:40:40 +0000</bug_when>
    <thetext>RFC 1738 specifies the following unsafe characters which should be always encoded:  &quot;{&quot;, &quot;}&quot;, &quot;|&quot;, &quot;\&quot;, &quot;^&quot;, &quot;~&quot;, &quot;[&quot;, &quot;]&quot;, and &quot;`&quot;.

&quot;`&quot; and &quot;\&quot; are already covered by the spec, but not the others.

The others seem to have less consistency across browsers:
- Firefox v25 encodes all of them except &quot;|&quot; and &quot;~&quot;.
- Chrome v31 encodes all of them except &quot;[&quot;, &quot;]&quot; and &quot;~&quot;. And converts &quot;\&quot; to &quot;/&quot;.
- IE v10 encodes all of them except &quot;[&quot;, &quot;]&quot; and &quot;~&quot;. And converts &quot;\&quot; to &quot;/&quot;.
- Safari v5:
   - When opening a link or using location.href: encodes none of them. And converts &quot;\&quot; to &quot;/&quot;.
   - When typing in the URL bar: encodes all of them except &quot;~&quot; (yes, even &quot;\&quot;).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>97868</commentid>
    <comment_count>1</comment_count>
    <who name="Santiago M. Mola">santi</who>
    <bug_when>2013-12-25 18:22:28 +0000</bug_when>
    <thetext>Some additional notes:

RFC 2396 actually removed &quot;~&quot; from the unwise character set.

I would say that all characters in the unwise character set as of RFC 2396 should be percent-encoded in URLs, with the only exception of the special handling of &quot;\&quot;.

That would make parsed URLs standard-compliant URIs. And that would be particularly good for interoperability with other systems.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98487</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-01-15 11:10:38 +0000</bug_when>
    <thetext>The RFCs you quote are obsolete. I think I copied Safari here, it being the most conservative.

Are browsers always converting them or only in path?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>98747</commentid>
    <comment_count>3</comment_count>
    <who name="Santiago M. Mola">santi</who>
    <bug_when>2014-01-19 01:42:12 +0000</bug_when>
    <thetext>I still haven&apos;t checked about escaping other than path.

RFC 3986 is the same as RFC 2396 regarding to this (they&apos;re not defined as the &quot;unwise&quot; character set, but they&apos;re still forbidden in path).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108541</commentid>
    <comment_count>4</comment_count>
    <who name="NARUSE, Yui">naruse</who>
    <bug_when>2014-07-01 02:36:39 +0000</bug_when>
    <thetext>I hit the issue and surveyed,

1. input following text in the address bar of the browser

http://example.com/ !&quot;$%&amp;&apos;()*+,-.:;&lt;=&gt;@[\]^_`{|}~? !&quot;$%&amp;&apos;()*+,-./:;&lt;=&gt;?@[\]^_`{|}~# !&quot;#$%&amp;&apos;()*+,-./:;&lt;=&gt;?@[\]^_`{|}~

2. show the page
3. copy the URL in the address bar

The result is following:

Chrome:
http://example.com/%20!%22$%&amp;&apos;()*+,-.:;%3C=%3E@[/]%5E_%60%7B%7C%7D~?%20!%22$%&amp;%27()*+,-./:;%3C=%3E?@[\]^_`{|}~# !&quot;#$%&amp;&apos;()*+,-./:;&lt;=&gt;?@[\]^_`{|}~

Safari:
http://example.com/%20!%22$%&amp;&apos;()*+,-.:;%3C=%3E@[/]^_`{|}~?%20!%22$%&amp;&apos;()*+,-./:;%3C=%3E?@[\]^_`{|}~#%20!&quot;#$%&amp;&apos;()*+,-./:;&lt;=&gt;?@[\]^_`{|}~

Firefox:
http://example.com/%20!%22$%&amp;%27%28%29*+,-.:;%3C=%3E@%5B%5C%5D%5E_%60%7B|%7D~?%20!%22$%&amp;%27%28%29*+,-./:;%3C=%3E?@[\]^_%60{|}~
#%20!%22#$%&amp;%27%28%29*+,-./:;%3C=%3E?@[\]^_%60{|}~

IE: error
IE without % in path:
http://example.com/%20!%22$&amp;&apos;()*+,-.:;%3C=%3E@[/]%5E_%60%7B%7C%7D~? !&quot;$%&amp;&apos;()*+,-./:;&lt;=&gt;?@[\]^_`{|}~# !&quot;#$%&amp;&apos;()*+,-./:;&lt;=&gt;?@[\]^_`{|}~</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108555</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-07-01 07:27:42 +0000</bug_when>
    <thetext>Yui, the address bar is part of the UI. It&apos;s not a good place to run URL tests in.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>108579</commentid>
    <comment_count>6</comment_count>
    <who name="NARUSE, Yui">naruse</who>
    <bug_when>2014-07-01 09:11:18 +0000</bug_when>
    <thetext>Santiago also tests with address bar.

As far as I understand, address bar gets various inputs, and output the escaped/normalized URL for other machines.
It must be meaningful.

Moreover you can see the difference between escaped characters in path/query/fragment.
For example Safari, Chrome and IE doesn&apos;t escape # in fragment.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>120993</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-06-15 14:47:53 +0000</bug_when>
    <thetext>(In reply to NARUSE, Yui from comment #6)
&gt; Santiago also tests with address bar.
&gt; 
&gt; As far as I understand, address bar gets various inputs, and output the
&gt; escaped/normalized URL for other machines.
&gt; It must be meaningful.

It&apos;s much more reliable to test how e.g. &lt;a&gt; or new URL() parses.


&gt; Moreover you can see the difference between escaped characters in
&gt; path/query/fragment.
&gt; For example Safari, Chrome and IE doesn&apos;t escape # in fragment.

The specification doesn&apos;t either at the moment, though I think Firefox hit some issues implementing that.

What exactly is the desired change here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>121209</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-06-18 09:44:07 +0000</bug_when>
    <thetext>I think this is mostly resolved now, especially given:

  https://github.com/whatwg/url/issues/16
  https://github.com/whatwg/url/issues/17

Please open new GitHub issues if there&apos;s anything left here.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>