Added a secondary link through code. Why is my href URL getting decoded? Added the following through code:

// $uri = custompath?type=All&amp;field_id=2&amp;storage=3 

$secondary_links['menu_custom_item'] = array(  
                      'attributes' =&gt; array( 'title' =&gt; $label ),
                      'alter'   =&gt; 1,
                      'href'    =&gt; $uri,
                      'title'   =&gt; $label,
                      'language'  =&gt; 'en' 
                );


Why is it that when drupal renders the link the URL it links to is something like:
http://mydomain.ca/custompath%3Ftype%3DAll%2526field_id%3D2%2526storage%3D201110

Literally it links like that and obviously returns Page Not Found. As soon as I manually change the %'s in the path we're good again. Is there a way to prevent this? Do I need to deconstruct the URI and pass the variables in one by one?
Try using urlencode ...

$secondary_links['menu_custom_item'] = array(  
                      'attributes' =&gt; array( 'title' =&gt; $label ),
                      'alter'   =&gt; 1,
                      'href'    =&gt; urlencode($uri),
                      'title'   =&gt; $label,
                      'language'  =&gt; 'en' 
                );