HashanChamara / php-form-builder-class

Automatically exported from code.google.com/p/php-form-builder-class
0 stars 0 forks source link

utf8 problem? #140

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
$text = "ção";
...
$form->->addElement(new PFBC\Element\Textbox("Localidade:", "localidade", 
array("value" =>$text)));
...

What is the expected output? 
ção
What do you see instead?
ção

What version of the product are you using? On what operating system?
2.2 

Original issue reported on code.google.com by recor...@ipb.pt on 16 Jun 2011 at 11:10

GoogleCodeExporter commented 8 years ago
There's a function in PFBC/Base.php named filter() that all attributes for the 
<input> tag will go before being inserted into the page.  This function calls 
htmlentities which may be causing issues with a string that already contains 
special characters like the example you provided.  I'll do some testing and 
come up with a fix for this.  Thanks for reporting.

- Andrew

Original comment by ajporterfield@gmail.com on 16 Jun 2011 at 8:55

GoogleCodeExporter commented 8 years ago
Try replacing the filter function in PFBC/Base.php with...

protected function filter($str) {
     return str_replace('"', '"', $str);
}

In my initial testing, this has corrected the issue.  Please verify.

- Andrew

Original comment by ajporterfield@gmail.com on 17 Jun 2011 at 3:11

GoogleCodeExporter commented 8 years ago
r528 includes this bug fix.

Original comment by ajporterfield@gmail.com on 17 Jun 2011 at 3:22

GoogleCodeExporter commented 8 years ago
works fine.
Thanks

Original comment by recor...@ipb.pt on 17 Jun 2011 at 9:30

GoogleCodeExporter commented 8 years ago
For me, it works better with this :
PFBC/Base.php:

    protected function filter($str) {
        return htmlentities($str, ENT_QUOTES, 'UTF-8');
    }

Original comment by KuruZman on 8 Sep 2011 at 9:14