title: Do colons require encoding in URI query parameters?
body: <p>I've noticed that Java's <code>UriBuilder</code> isn't encoding the <code>:</code> characters included in my query parameter values (ISO 8601-formatted strings).</p>
  <p>According to Wikipedia, it seems colon should be encoded.</p>
  <blockquote>
  <p>In particular, encoding the query string uses the following rules:</p>
  <ul>
  <li>Letters (A-Z and a-z), numbers (0-9) and the characters '.','-','~' and '_' are left as-is</li>
  <li>SPACE is encoded as '+' or %20[citation needed]</li>
  <li>All other characters are encoded as %FF hex representation with any non-ASCII characters first encoded as UTF-8 (or other specified
  encoding)</li>
  </ul>
  </blockquote>
  <p>So, what's the deal?  Should colons in query parameters be encoded or not?</p>
  <hr />
  <p><strong>Update:</strong></p>
  <p>I looked up the URI Syntax spec (<a href="https://www.rfc-editor.org/rfc/rfc3986" rel="nofollow noreferrer">RFC 3986</a>) and it looks like encoding colons in query params really isn't necessary.  Here's an excerpt from the ABNF for URI:</p>
  <pre><code>URI         = scheme &quot;:&quot; hier-part [ &quot;?&quot; query ] [ &quot;#&quot; fragment ]
  query       = *( pchar / &quot;/&quot; / &quot;?&quot; )
  pchar         = unreserved / pct-encoded / sub-delims / &quot;:&quot; / &quot;@&quot;
  unreserved    = ALPHA / DIGIT / &quot;-&quot; / &quot;.&quot; / &quot;_&quot; / &quot;~&quot;
  pct-encoded   = &quot;%&quot; HEXDIG HEXDIG
  sub-delims    = &quot;!&quot; / &quot;$&quot; / &quot;&amp;&quot; / &quot;'&quot; / &quot;(&quot; / &quot;)&quot; / &quot;*&quot; / &quot;+&quot; / &quot;,&quot; / &quot;;&quot; / &quot;=
  </code></pre>