PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » Pager » Bug #10085

using GET vars for paging and UTF8 on page pager urls get messed up

Details

Submitted2007-02-13 12:11 UTC
Fromironclad at freemail dot hu
Assignedquipo
StatusClosed
PackagePager
PHP Version5.2.0
OSwindows xp 32bit
Roadmaps(Not assigned)

Comments

[2007-02-13 12:11 UTC] ironclad at freemail dot hu

Description:
------------
Pager I'm using is 2.4.3

I have a page encoded in UTF-8 and need to use characters like ő, ű in it in a form that is used to filter the results shown using the Pager.

If I replace line 1310 in Common.php in the pager package with this:

array_push($tmp, $name.'%5B'.htmlentities($key).'%5D='.urlencode($value));

(originally urlencode was htmlentities) and / or for faster? parsing put this into function _http_build_query_wrapper($data) right after the $separator var testing and setting to '&' in line 1267

if(function_exists('http_build_query')) { // PHP 5.1.2+
return http_build_query($data, '', $separator);
}

Then it's all fine.

As a note using htmlentities($value, ENT_QUOTES, 'UTF-8');
instead of urlencode still messes things up...

Test script:
---------------
page:

<form method="POST">
<input type="text" name="s[bruhaha]"value="ők" />
</form>
.. pager output...

pager setup:
$params = array(
'itemData' => array('őkelme', 'mőkel', 'eeeee'),
'perPage' => 1,
'importQuery' => true,
'delta' => 2,
'separator' => ' | ',
'clearIfVoid' => true,
'urlVar' => 'pg',
'mode' => 'Sliding',
'excludeVars' => array(),
);
$pager = &Pager::factory($params);
$links = $pager->getLinks();
$res = $pager->getPageData();

Expected result:
----------------
.. pager generated $links contain a messed up href value. Not s[bruhaha]=ők as it should be.

Actual result:
--------------
s%5Bbruhaha%5D=Å%EF%BF%BDk