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

Bug #17876 encoding issues with input already utf8
Submitted: 2010-09-20 20:51 UTC
From: ahto Assigned: izi
Status: Closed Package: Services_GeoNames (version 1.0.0)
PHP Version: 5.3.2 OS: Ubuntu 10.04
Roadmaps: (Not assigned)    
Subscription  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 44 - 1 = ?

 
 [2010-09-20 20:51 UTC] ahto (Ahto Jussila)
Description: ------------ In function formatQueryString in file GeoNames.php there are two lines which inlude this "urlencode(utf8_encode(". When the input that is passed to the script is already encoded in utf-8. this makes the non ascii characters blow up. Test script: --------------- <?php require_once 'Services/GeoNames.php'; class testgeo extends Services_GeoNames{ public function formatQueryString($params = array()) { $qString = array(); foreach ($params as $name => $value) { if (is_array($value)) { foreach ($value as $val) { $qString[] = $name . '=' . urlencode(utf8_encode($val)); } } else { $qString[] = $name . '=' . urlencode(utf8_encode($value)); } } return implode('&', $qString); } } $geo = new testgeo(); echo urldecode($geo->formatQueryString(array('name_equals' => 'mänttä'))); Expected result: ---------------- name_equals=mänttä Actual result: -------------- name_equals=mänttä

Comments

 [2010-10-01 14:55 UTC] izi (David Jean Louis)
-Status: Open +Status: Closed -Assigned To: +Assigned To: izi
This bug has been fixed in SVN. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. Fixed now, thanks for the report Ahto.