Welcome Guest, Not a member yet? Register   Sign In
Even with ( and ) in permitted_uri_chars - they're being converted to safe html entities
#1

[eluser]jedd[/eluser]
Hopefully an easy one.

I want to have parenthesis - '(' and ')' - characters allowed in my URLs. I've modified my config.php thus:
Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-+()';

But when I grab the segments in my URL using $this->uri->segment_array(); this is what happens to my parameters:
Code:
// input url ==  album/gallery/i4c3d775755/fSOMEWHERE+in+singapore+(temp+label)

$segs  = $this->uri->segment_array();
dump ($segs);

// produces:
array
  1 => string 'album' (length=5)
  2 => string 'gallery' (length=7)
  3 => string 'i4c3d775755' (length=11)
  4 => string 'fSOMEWHERE+in+singapore+& #40;temp+label& #41;' (length=44)

// Note - spaces added between & and # so this forum doesn't re-interpret them back to ( and ).

I suspect I can de-entity the string as I pull it in on my uri->segment_array () call but I'm wondering if there's some other magic I can do in order to enforce some non-munging of anything in permitted_uri_chars


EDIT: Ahh, here's the problem - in the URI library, line 197+ in the _filter_uri() method:
Code:
// Convert programatic characters to entities
$bad    = array('$',         '(',         ')',         '% 28',         '% 29');
$good    = array('& #36;',    '& #40;',    '& #41;',    '& #40;',    '& #41;');

return str_replace($bad, $good, $str);
(Again, I put a space between & and # there, lest the CI forum confusingly de-mung things and make everyone wonder what the problem is.)

Knowing the problem is good, but a nice solution doesn't immediately present itself.


Messages In This Thread
Even with ( and ) in permitted_uri_chars - they're being converted to safe html entities - by El Forum - 11-01-2009, 07:59 PM



Theme © iAndrew 2016 - Forum software by © MyBB