Welcome Guest, Not a member yet? Register   Sign In
What to expect from permitted_uri_characters
#1

[eluser]c77m[/eluser]
I've read several threads on related issues, and I have a few different ways to "fix" my issue. However, I'd really like to understand *why* I have the issue so I don't cause myself future headaches by making it work like I expect it to.

permitted_uri_characters is taken into account when generating URLs (eg. via title_url()), but that has no impact on the parameter string being available to the controller when the URL is loaded.

Example controller function:
Code:
function view($str = NULL)
{
    echo "str is '$str'";
}

Example view snippet that links to this function:
Code:
$name = 'john x. doe';
<a href="&lt;?= base_url() . url_title('thecontroller/view/' . $name) ?&gt;">Click here</a>

// Generated link is "http://localhost/thecontroller/view/john-x.-doe

Output from the controller:
Quote:str is 'john-x_-doe'

My expectation would be that permitted_uri_characters and url_title() would work together to create a link with accessible strings, but it does not. e.g. url_title would generate <b>john-x_-doe</b> or the function paramater would equal <b>john-x.-doe</b>.

Fixing this with a custom library is quite simple.. so simple that it makes me think I am missing something. Does a function already exist to produce URL strings that include only readable parameters?
#2

[eluser]Cristian Gilè[/eluser]
base64_encode

Cristian Gilè
#3

[eluser]c77m[/eluser]
[quote author="Cristian Gilè" date="1294960121"]base64_encode[/quote]

The data is already utf-8 encoded, which is friendly to the database, filesystem, and webserver. Agreed that I could encode all sorts of undesirable information into the URL, but I prefer to understand how permitted_uri_characters are intended to relate to allowable parameters.




Theme © iAndrew 2016 - Forum software by © MyBB