How can I stop Views from eating my query strings when rewriting a link? I have a view and I am trying to rewrite the links by appending a query string.

[name_1] is the name of the location.  The various values for age[] are the taxonomy term IDs for an exposed filter, and friends is a profile field.

Under Rewrite results, I have checked Output this field as a link.  This is my link:

location/[name_1]?age[]=27&amp;age[]=31&amp;age[]=35&amp;age[]=39&amp;age[]=43&amp;age[]=44&amp;friends=1


When I cut and paste the query string into the URL bar, it works fine.  However, when I tell views to rewrite the string I get URLs that look like this:

location/mexico?friends=1&amp;age[]=44


This gives me no results and a broken view.

It appears that the query strings are processed in reverse, and it only accepts the first value for age[]-- even though when I type the same thing into the URL bar it is OK.

I tried replacing the symbols in the rewriting string like this:

location/[name_1]age%5B%5D=27&amp;age%5B%5D=31&amp;age%5B%5D=35&amp;age%5B%5D=39&amp;age%5B%5D=43&amp;age%5B%5D=44&amp;friends=1


Now, when I access the view, I no longer get an error, but none of the age (taxonomy term) checkboxes are checked and the URL looks like this:

http://localhost:8888/en/location/mexico?age%255b%255d=44&amp;friends=1


So, clearly most of the age[] values are still disappearing for some reason.

How can I rewrite the query string so that views outputs it properly?

EDIT: According to Jimajamma's comment, D6 Views suggests using %5B%5D, as I have already tried (I'm on D7).  &amp;#91;&amp;#93; didn't work for me either (this combo doesn't even work in the URL bar).  Perhaps this is a bug in Views?

EDIT 2: As per the answers, this appears to be a bug in Drupal Core/Views, not a configuration error.  So I attempted to avoid using Views rewrite results output as a link feature and instead just rewrite results and code the link in HTML.

The only problem with this approach is that some of the terms have spaces in their names, and I was using the convert spaces to dashes option provided by the output as a link setting to get around this.  So now the links for terms that have no spaces work properly, but the links for terms with spaces are broken...
Issue is not with views. What views does is it calls drupal_get_query_array to build the query array. And as of now drupal_get_query_array does not support same name array in the query params. All it does is just explodes the query and saves it as follows;

$result[$param[0]] = isset($param[1]) ? rawurldecode($param[1]) : '';


So if you see the see it is going to be overridden and it is just going to store 

array ('age' =&gt; 44, 'friends' =&gt; 1)


I have created a ticket and reported this issue and attached a patch as well at https://drupal.org/node/2023815

The same patch should work for 7.x as well.

Alternatives

So Views php / Custom module looks like a good alternative without hacking the core.