Apache mod_rewrite have proven to be unreliable, as it does some decoding and reencoding of the URL paths. Trying to match Apache's encoding/decoding rules with PHPs one as proven difficult, and we are still using the ugly drupal_urlencode() to double encode some characters of the path.
Let's not depend on Apache / PHP for this, and derive paths from the URL ourselves.
- adds path-deriving logic to drupal_initialize_variables()
- removes drupal_urlencode()
- implements drupal_path_encode(), that is specialized in encoding the path part of the URL
- implements a throughout test case