<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
So you want to replace the spaces, but not any of the non-alpha
characters? Sounds more like a preg_replace() action.<br>
That way you could just create an array of patterns you want to
replace, rather than doing a real urlencode.<br>
<br>
-Don Pickerel-<br>
<br>
On 3/11/2010 9:17 AM, nitin gupta wrote:
<blockquote
 cite="mid:4f59ac611003110617k2b749541k9694f163920dc16f@mail.gmail.com"
 type="cite">Thanks Earnie, but that is not what I am looking for. It
is essentially similar to urlencode or rawurlencode. I am looking for a
function that does the work like the one present at the bottom of the
page here:<br>
  <br>
  <a moz-do-not-send="true"
 href="http://www.blooberry.com/indexdot/html/topics/urlencoding.htm">http://www.blooberry.com/indexdot/html/topics/urlencoding.htm</a><br>
  <br>
For eg:<br>
  <br>
  <a moz-do-not-send="true" href="http://example.com/q=12">http://example.com/q=12</a>
&amp;12grt key=value;&lt;&gt;+,.()!*<br>
  <br>
is converted to <br>
  <br>
  <a moz-do-not-send="true"
 href="http://example.com/q=12%20&amp;12grt%20key=value;%3C%3E+,.%28%29%21*">http://example.com/q=12%20&amp;12grt%20key=value;%3C%3E+,.()!*</a><br>
  <br>
  <br clear="all">
--<br>
Regards,<br>
Nitin Kumar Gupta<br>
  <a moz-do-not-send="true" href="http://publicmind.in/blog/">http://publicmind.in/blog/</a><br>
  <br>
  <br>
  <div class="gmail_quote">On Thu, Mar 11, 2010 at 7:32 PM, Earnie Boyd
  <span dir="ltr">&lt;<a moz-do-not-send="true"
 href="mailto:earnie@users.sourceforge.net">earnie@users.sourceforge.net</a>&gt;</span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">nitin
gupta wrote:<br>
    <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
&nbsp;Hi,<br>
      <br>
      <div class="im">&nbsp;I am not creating the URL, but I parse the URL
from XML content and I<br>
&nbsp;want to urlencode it. Also, I am looking to preserve all the reserved<br>
&nbsp;characters in the URL and not just '?' or '&amp;'.<br>
      <br>
      </div>
    </blockquote>
    <br>
    <a moz-do-not-send="true"
 href="http://www.google.com/search?q=url+encoding+site%3Aapi.drupal.org"
 target="_blank">http://www.google.com/search?q=url+encoding+site%3Aapi.drupal.org</a>
leads you to two api functions url [1] and drupal_urlencode [2]. &nbsp;Are
these what you need?<br>
    <br>
[1] <a moz-do-not-send="true"
 href="http://api.drupal.org/api/function/url" target="_blank">http://api.drupal.org/api/function/url</a><br>
[2] <a moz-do-not-send="true"
 href="http://api.drupal.org/api/function/drupal_urlencode"
 target="_blank">http://api.drupal.org/api/function/drupal_urlencode</a><br>
    <font color="#888888"><br>
--<br>
Earnie<br>
-- <a moz-do-not-send="true" href="http://www.give-me-an-offer.com"
 target="_blank">http://www.give-me-an-offer.com</a><br>
    <br>
    </font></blockquote>
  </div>
  <br>
</blockquote>
<br>
</body>
</html>