> As I've mentioned before, I'm pretty sure it's the encoding hack
> I set up to keep ampersands in titles _in_ the titles instead of
> as raw ampersands that indicate the beginning of the next variable
> in the query string:
>
> RewriteEngine On
> RewriteMap urlencode prg:/usr/local/bin/urlencode
> RewriteRule ^/wiki/(.*)$ /w/wiki.phtml?title=${urlencode:$1} [L]
>
> If the hackish little external program should die or get out of
> sync, we end up with the wrong URLs. But this ugliness *shouldn't*
> be needed. We *should* be able to use the internal function that
> Apache provides for this...
You are mistaken that Apache is doing the wrong thing: ampersands
are /not/ supposed to be urlencoded--they are valid and meaningful
characters needed for URLs. But ampersands do need to be messed with
for Wikipedia-specific reasons: since article titles must appear as
values in the query string (which is separated by ampersands), they
must be escaped somehow for that function. Also, the
non-escaped ampersands in the URL must be HTML-escaped when they
appear as attribute values, such as HREFs. These are both entirely
separate issues, and the code formerly dealt with them correctly,
although in a way that you didn't like. We may have to compromise;
accept the double-encoding for ampersands that you removed for other
characters. Either that, or come up with some other escaping
mechanism for ampersands in titles.