I have the following test case controller setup in a codeigniter framework:
class Test extends Controller {
public function Test()
{
parent::Controller();
}
public function index($bla = ''){
echo $this->uri->segment(3) . '<br/>';
echo $bla . '<br/>';
$url = site_url('test') . '/index/' . rawurlencode('foo bar') . '/';
echo "<a href=\"$url\">click me</a>";
}
}
I would like $bla
to echo 'foo bar', not 'foo_bar'. Regardless if I use rawurlencode, urlencode, or nothing at all, there is a '_' being inserted for the space character. I have confirmed the href for the anchor does include the %20 sign, so I don't understand why the string is being altered.
I have included two screen shots to illustrate the point, the first image shows when no argument is passed to the controller, the second is with the 'foo bar' passed to it. I just don't understand why 'foo%20bar' would be altered?