Print full node url escaping special characters?
The proper way to generate a URL is with the url() function, and the absolute option:

$absolute_url = url('node/123', array('absolute' =&gt; TRUE));


You then need to encode it:

$encoded_url = rawurlencode($absolute_url);


This work should be done in a preprocess function, and the variable added to $variables, and not done in the .tpl.php file directly:

function MYTHEME_preprocess_node(&amp;$variables) {
  $absolute_url = url('node/123', array('absolute' =&gt; TRUE));
  $encoded_url = rawurlencode($absolute_url);

  $variables['encoded_url'] = $encoded_url;
}


and then printed in the template.

&lt;?php print $encoded_url ?&gt;


However, you more than likely want to use the query option or drupal_http_build_query  for whatever you are trying to use this for.  What you are describing typically isn't needed directly.  Giving the proper advice, though, is a little hard without more context.