W3C home > Mailing lists > Public > www-talk@w3.org > November to December 2003

Re: Sending special characters

From: Ian Clelland <ian@veryfresh.com>
Date: Wed, 3 Dec 2003 11:50:25 -0800
To: www-talk@w3.org
Message-ID: <20031203195025.GB1694@fullfactor.com>

On Sat, Nov 29, 2003 at 12:56:24PM -0000, Gon?alo Silva Dias wrote:
> Hi ppl,
> 
> How can I send characters in the url like
> http://parede.hn.org/index.php?info=?
> 
> Anyone knows how to do that?


If you need to include reserved characters, such as "?", ";" or "/", in a
URL query part (the bit after the first '?'), you have to encode them.  You
can send any ASCII character in a URL by encoding it as "%hh" where "hh"
is the hex value for the character code. For example, "?" encodes as "%3f",
and "%" encodes as "%25".

Your example, then, would be a proper URL like this:
http://parede.hn.org/index.php?info=%3f

If you are using PHP to construct your URLs, use the function
urlencode() on your strings before including them in the URL. (see
http://www.php.net/manual/en/function.urlencode.php for more details)

Hope this helps,

Ian Clelland
<ian@veryfresh.com>
Received on Wednesday, 3 December 2003 14:50:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 27 October 2010 18:14:28 GMT