I’m developing a CakePHP application which uses the standard CakePHP URL schema.
If I use the following function in a Controller:
class IndexController extends AppController {
public $uses = false;
public function test($a) {
var_dump($a);
}
}
And call it with this URL:
http://server/index/test/Hello+%2BTest
I get this result:
string(11) "Hello++Test"
I would expect the first “+” to be unescaped to ” “. Why doesn’t this happen?
I think you mean “unencode” instead of “unescape”.
This is happening probably because the + sign is a valid character for a URL. Only the urlencoded characters (i.e. %xx) will be converted back to “readable” characters. (though pretty sure this is done by Apache, not cake)
If you want to force conversion, you can just run it through PHP’s urldecode() function.
From RFC 1738 :