Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.1

Bug #4897 incorrect links when include Multibyte String
Submitted: 2005-07-23 08:16 UTC
From: kenchou77 at gmail dot com Assigned: quipo
Status: Closed Package: Pager
PHP Version: Irrelevant OS:
Roadmaps: (Not assigned)    
Subscription  


 [2005-07-23 08:16 UTC] kenchou77 at gmail dot com
Description: ------------ Pager build incorrect query string on chinese chars. Maybe all htmlentities should replace with htmlspecialchars.

Comments

 [2005-08-01 17:44 UTC] astor at 21cn dot com
I think this bug is caused by the usage of htmlentities instead of urlencode, since 2.3.0 works well.
 [2005-08-04 17:06 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-08-05 08:23 UTC] kenchou77 at gmail dot com
The test Script based on docs/Pager/example/example.php: <?php require_once 'Pager/Pager.php'; //create dummy array of data $myData = array(); for ($i=0; $i<200; $i++) { $myData[] = $i; } //set a string $test_string = '测试'; $params = array( 'itemData' => $myData, 'perPage' => 10, 'delta' => 8, 'append' => true, 'clearIfVoid' => false, 'urlVar' => 'entrant', 'useSessions' => true, 'closeSession' => true, 'mode' => 'Jumping', 'extraVars' => array('test' => $test_string) ); $pager = & Pager::factory($params); $page_data = $pager->getPageData(); $links = $pager->getLinks(); $selectBox = $pager->getPerPageSelectBox(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>Pager Test</title> </head> <body> <?php //compare string if (isset($_REQUEST['test'])) { $request_test = $_REQUEST['test']; var_dump($request_test, $test_string, ($request_test == $test_string)); } ?> <table border="1" width="500" summary="example 1"> <tr> <td colspan="3" align="center"> <?php echo $links['all']; ?> </td> </tr> <tr> <td colspan="3"> <pre><?php print_r($page_data); ?></pre> </td> </tr> </table> <h4>Results from methods:</h4> <pre> getCurrentPageID()...: <?php var_dump($pager->getCurrentPageID()); ?> getNextPageID()......: <?php var_dump($pager->getNextPageID()); ?> getPreviousPageID()..: <?php var_dump($pager->getPreviousPageID()); ?> numItems()...........: <?php var_dump($pager->numItems()); ?> numPages()...........: <?php var_dump($pager->numPages()); ?> isFirstPage()........: <?php var_dump($pager->isFirstPage()); ?> isLastPage().........: <?php var_dump($pager->isLastPage()); ?> isLastPageComplete().: <?php var_dump($pager->isLastPageComplete()); ?> $pager->range........: <?php var_dump($pager->range); ?> </pre> <hr /> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET"> Select how many items per page should be shown:<br /> <?php echo $selectBox; ?>   <input type="submit" value="submit" /> </form> <hr /> </body> </html> ------------- Expected result: string(8) "测试" string(4) "测试" bool(true) ----------- Actual result: string(8) "虏芒脢脭" string(4) "测试" bool(false)
 [2005-09-27 04:29 UTC] daniel at konczyk dot net
You need to encode the var before you use htmlentities, otherwise, htmlentities encodes the multibyte char wrong. I've made a change in _http_build_query_wrapper function: 1175 array_push($tmp, key.'='.urlencode($val)); And that fixes the problem. Well, as far as I tested.. I'm using 2.3.0
 [2005-09-27 07:53 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2005-09-28 08:05 UTC] kenchou77 at gmail dot com
OK, the latest CVS version works correctly :)
 [2005-09-28 18:17 UTC] daniel at konczyk dot net
It works for me too (latest cvs) Can you please make a new release then?
 [2005-09-28 19:20 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!