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

Bug #12853 Console_Table relies on str_pad which is not MultiByte compliant
Submitted: 2008-01-08 16:32 UTC
From: guibod Assigned: yunosh
Status: Closed Package: Console_Table (version 1.0.7)
PHP Version: 5.2.4 OS: Any
Roadmaps: (Not assigned)    
Subscription  


 [2008-01-08 16:32 UTC] guibod (Guillaume Boddaert)
Description: ------------ In short, the class works perfectly good and is able to detect MultiByte strings lengths, which is good. Unfortunatly when comes the time to pad the string it uses a non MultiBytes compliant function : str_pad. The bug seems to occur only when a mb string is shorter than a standard string. Test script: --------------- $headers = array('String','Currency','Symbol'); $data = array( array('This is an english string', '$ 100,00','Dollar', '$'), array('Cette chaîne de caractères est écrite en français','¤ 100,00','Euro','¤'), array('An even longer english string with obviously no multibytes caracters, fairly longer than the french one.','$ 100,00','Dollar (again)','$') ); $table = new Console_Table(); $table->setCharset('utf-8'); $table->setHeaders($headers); $table->setAlign(1,CONSOLE_TABLE_ALIGN_RIGHT); $table->addData($data); echo $table->getTable(); Expected result: ---------------- +----------------------------------------------------------------------------------------------------------+----------+----------------+---+ | String | Currency | Symbol | | +----------------------------------------------------------------------------------------------------------+----------+----------------+---+ | This is an english string | $ 100,00 | Dollar | $ | | Cette chaîne de caractères est écrite en français | ¤ 100,00 | Euro | ¤ | | An even longer english string with obviously no multibytes caracters, fairly longer than the french one. | $ 100,00 | Dollar (again) | $ | +----------------------------------------------------------------------------------------------------------+----------+----------------+---+ Actual result: -------------- +----------------------------------------------------------------------------------------------------------+----------+----------------+---+ | String | Currency | Symbol | | +----------------------------------------------------------------------------------------------------------+----------+----------------+---+ | This is an english string | $ 100,00 | Dollar | $ | | Cette chaîne de caractères est écrite en français | ¤ 100,00 | Euro | ¤ | | An even longer english string with obviously no multibytes caracters, fairly longer than the french one. | $ 100,00 | Dollar (again) | $ | +----------------------------------------------------------------------------------------------------------+----------+----------------+---+

Comments

 [2008-01-08 23:35 UTC] yunosh (Jan Schneider)
Thank you for your bug report. This issue has been fixed in the latest released version of the package, which you can download at http://pear.php.net/get/Console_Table