[PEAR-BUG] Bug #20489 [Com]: Textareas with umlauts or other special chars are rendered empty

[email protected] ("hanousman") Fri, 8 Sep 2017 10:26:14 -0400 (EDT)
Newsgroups php.pear.bugs
Message-ID <[email protected]>
Edit report at http://pear.php.net/bugs/bug.php?id=20489&edit=1

 ID:               20489
 Comment by:       hanousman
 Reported By:      mg2aire-pear at yahoo dot com
 Summary:          Textareas with umlauts or other special chars are
                   rendered empty
 Status:           Open
 Type:             Bug
 Package:          HTML_QuickForm
 Operating System: Kubuntu 14.04.1
 Package Version:  3.2.14
 PHP Version:      >=5.4
 New Comment:

The culprit is htmlspecialchars in element.php, textarea.php and so on.

It doesn't work if the text encoding parameter is not set correctly.

You can try to use htmlspecialchars ( $string , ENT_COMPAT | ENT_HTML401
| ENT_SUBSTITUTE )

ENT_SUBSTITUTE : Replace invalid code unit sequences with a Unicode
Replacement Character U+FFFD (UTF-8) or ? (otherwise) instead of
returning an empty string.


Previous Comments:
------------------------------------------------------------------------

[2015-01-19 21:53:38] fhbo_fbw

<div id="changeset">
<span class="removed">-PHP Version: Irrelevant</span>
<span class="added">+PHP Version: &gt;=5.4</span>
</div>

------------------------------------------------------------------------

[2015-01-19 17:41:33] fhbo_fbw

Description:
------------
When creating text areas, default values containing umlauts or other
special chars force them to be rendered completely empty. 

Test script:
---------------
<?php
  require_once "HTML/QuickForm.php";

  $form = new HTML_QuickForm('register', 'post'); 
  $form->addElement('text', 't1', 'Text'); 
  $form->addElement('textarea','ta','Text area');
  $form->addElement('submit','sb','Submit form');

  $form->setDefaults(array("t1"=>"äöüß", "ta"=>"äöüß"));
  $form->display();
?>

Expected result:
----------------
text inputs and text area inputs showing äöüß as initial value

Actual result:
--------------
only text inputs showing äöüß as initial value

------------------------------------------------------------------------


-- 
Edit this bug report at http://pear.php.net/bugs/bug.php?id=20489&edit=1