Apache's mod_rewrite provides an escape function, whose complete
documentation is:

  Translates special characters in [its input] to hex-encodings.

So I tried to use it on a website to translate visible URLs such as:

  http://www.example.com/menu/Yorkshire_Pudding
  http://www.example.com/menu/Fish&Chips

into a CGI call with parameters:

  http://www.example.com/menu.cgi?item=Yorkshire_Pudding
  http://www.example.com/menu.cgi?item=Fish&Chips

Except that last one is wrong: the ampersand gets interpreted as
starting a second CGI parameter; to do what I want it needs escaping as
%26.  Which is why I was using the escape function in the first place.

And that was my mistake.  Because by "special characters" it this
function for use in rewriting URLs hatefully didn't mean characters that
are special in URLs; it apparently meant characters that are special in
OS filenames!  No, really:

  http://issues.apache.org/bugzilla/show_bug.cgi?id=39739

Why is that more useful in a URL rewriter than escaping characters that
are special in URLs?  Would escaping ampersand and plus as well (which
is harmless in the cases it's unnecessary) really have been too hard?
And ... how on earth with that documentation was I supposed to guess at
what your hateful function does?

Smylers

Reply via email to