Bug #15791 [Opn]: Lowercase characters are removed

From: Date: Fri, 20 Feb 2009 15:44:50 +0000
Subject: Bug #15791 [Opn]: Lowercase characters are removed
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-48@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=15791&edit=1 ID: 15791 Updated by: info@mschuette.name Reported By: cw at payment-network dot com Summary: Lowercase characters are removed Status: Open Type: Bug Package: Payment_DTA Package Version: 1.3.0a3 PHP Version: Irrelevant -Assigned To: +Assigned To: mschuett Roadmap Versions: New Comment: <div id="changeset"> <span class="removed">-Assigned To:</span> <span class="added">+Assigned To: mschuett</span> </div> The removal of lowercase characters was caused by a wrong order of checks and is fixed (in 1.3.0a4). To approach the encoding issue I now use mb_convert_encoding() with mb_internal_encoding() as a possible source encoding. So far I did small tests with UTF-8 and ISO-8859-1 and it worked quite well. I would appreciate feedback on this. Previous Comments: ------------------------------------------------------------------------ [2009-02-06 07:00:29] doconnor <div id="changeset"> <span class="removed">-Status: Feedback</span> <span class="added">+Status: Open</span> </div> ------------------------------------------------------------------------ [2009-02-06 06:59:34] doconnor Hi Daniel, I'm not sure, why I can't put a comment to the bug #15791. Maybe its because of the status you set: -Status: Open +Status: Feedback Here my message: I run in to the same bug. I wrote a small test script for command line. Maybe its time to write some real unit tests. Here just the "small executable test script": <?php require_once 'Payment_DTA-1.3.0a3/DTA.php'; $dta_file = new DTA(DTA_DEBIT); echo $dta_file->makeValidString('THIS STRING IS VALID.'); echo "\n"; echo $dta_file->makeValidString('lower case values.'); echo "\n"; echo $dta_file->makeValidString('Umlate: ÜÖÄüöä ß?.'); echo "\n"; ?> ------------------------------------------------------------------------ [2009-02-03 14:46:34] doconnor <div id="changeset"> <span class="removed">-Status: Open</span> <span class="added">+Status: Feedback</span> </div> Hey Clemens, would you mind making a small executable test script which clearly proves it? Easier to fix it then... ------------------------------------------------------------------------ [2009-01-28 05:15:56] mensler Another idea: Make the input encoding configurable and convert the input strings to UTF-8 using mb_convert_encoding() or iconv(). ------------------------------------------------------------------------ [2009-01-28 04:59:22] mensler Also you don't set the encoding on mb_* functions to the encoding of the input string. May I suggest the following: Replace validString_chars with a regular expression: 0-9a-z \.,&\-\/\+\*\$% I left out äöüß because it's replaced later anyway and so you don't get problems with the output encoding (where ISO 646 is needed). Replace the body of validString() with return preg_match("/^[{$this->validString_chars}]$/i", $string); or remove the method, as it's not used. In makeValidString() remove the for-loop and replace it with $result = strtr($string, $special_chars); $result = preg_replace("/[^{$this->validString_chars}]/i", ' ', $result); Now the input string has to be UTF-8, but I think this is an acceptable interface change. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://pear.php.net/bugs/bug.php?id=15791 -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=15791&edit=1

« previous php.pear.bugs (#48) next »