• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Special characters in the URI?

Is there a way to encode special characters in the URI without enabling them all in the config? I tried using urlencode(), but the percent signs mess everything up and for some reason the server spits out:
Bad Request
Your browser sent a request that this server could not understand.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I guess a solution would be to step through the string before it is put in the uri and encode the special characters myself. I could look at each char, see if it is a special character, and if it is, replace it with _asc(character)_. That would be ugly, increase the length of my uri, and it makes me feel dirty. Please don't make me do this. Smile

CI has a function url_title(), in the uri helper that does this for you.
$dirty_uri = 'This IS %% a ?>:freaky uri';

$clean_uri = url_title($dirty_uri);


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.