tablesort and pager is not working correctly for certain paths.
If query part of an url contains parameters with special chars, pager and tablesort urlencodes these parameters twice. It breaks filters in views and other custom modules that uses variables passed via GET method to filter tables and node lists.

This bug can be easyly shown on example:
We have a table view with filter, which can be seen at
http://emhartglass.com/library

On this page we can use category filter to narrow results. Choosing a text value containing special chars, like 'Other inspections & Ware handling' results in url:
http://emhartglass.com/library?filter0=**ALL**&filter1=Other+Inspection+...
The url is OK, but when we try to use pager or table sort, the url looks like this:
http://emhartglass.com/library?page=1&filter0=%2A%2AALL%2A%2A&filter1=Ot...

Query parameters have been encoded twice, changing from:
filter1=Other+Inspection+%26+Ware+Handling
to
filter1=Other+Inspection+%2526+Ware+Handling
which stands for
'Other Inspection %26 Ware Handling'

My hotfix for tablesort is to change one line in tablesort.inc
$cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']) . $ts['query_string'], NULL, FALSE, TRUE);
to:
$cell['data'] = l($cell['data'] . $image, $_GET['q'], array('title' => $title), 'sort='. $ts['sort'] .'&order='. urlencode($cell['data']) . urldecode($ts['query_string']), NULL, FALSE, TRUE);

Still looking for solution for pager, which is more complex.

Comments

drumm’s picture

Status: Active » Closed (duplicate)

I believe this would be fixed with http://drupal.org/node/178615

Pawel Gawlowski’s picture

Status: Closed (duplicate) » Closed (fixed)

Yes, patch from http://drupal.org/node/178615 solves the problem.