Welcome Guest, Not a member yet? Register   Sign In
confused about url encoding
#1

[eluser]Jackpod[/eluser]
I am using CI v2.0.2

And in case this comes up later in the discussion, the permitted uri characters setting and query strings setting have not been changed from the default and are:

Code:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
$config['enable_query_strings'] = FALSE;

The url http://mydomain.com/home/index/% 40 maps to this controller:

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Home extends CI_Controller
{
    
    public function index($test)
    {
        echo $test;
    }
    
}

And if I visit the page is see:

% 40

Now this functionality is fine with me, and I can easily add PHP's urldecode function to my controller.

But I have a few questions...

1) From looking at other posts (such as http://ellislab.com/forums/viewthread/126414 ), it appears that my CI installation, out of the box, is functioning differently and is allowing % 40 in urls instead of disallowing them. Can someone confirm if this is correct behavior now in version 2.0.2 ?

2) Is it "normal" to use urldecode in CI controllers? (i.e. Should I be adding urldecode to every controller I write to be sure that any url encoded characters are handled preoperly?)

3) If the answer to question 2 is yes, then why doesn't CI simply urldecode the paramaters automatically before they are sent to the controllers? (honestly I was surprised to see that it isn't doing this already)




Theme © iAndrew 2016 - Forum software by © MyBB