[drupal-devel] urlencode
Hi! The problem is that if you have for eg. a slash in the string it will cause problems, it needs to be urlencoded. But PHP urlencode does not escape the slash. So I propose that we change urlencode to drupal_urlencode, as follows: function _drupal_urlencode($matches) { return '%'. dechex(ord($matches[0])); } function drupal_urlencode($string) { return preg_replace_callback('/[^[:alpha:]]/', '_drupal_urlencode', $title); } Of course, I'd love to see a simpler approach to the problem, but that's what came to my regexp obsessed mind... Regards NK
The problem is that if you have for eg. a slash in the string it will cause problems, it needs to be urlencoded. But PHP urlencode does not escape the slash.
What exactly is the problem with this? If you escape a slash in an URL as %XX, then it will still arrive in Drupal as a slash, so you cannot use it to escape slashes in menu paths. Steven
participants (2)
-
Karoly Negyesi -
Steven Wittens