ZF-5081: Zend_View_Helper_FormSelect escaping html entities

Issue Type: Improvement Created: 2008-11-27T04:40:55.000+0000 Last Updated: 2010-03-16T02:02:19.000+0000 Status: Resolved Fix version(s): Reporter: Chris Lock (catharsisjelly) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_View

Related issues: - ZF-8722



I am trying to create a select with currency and Im providing it a HTML entity for the Euro, which then gets encoded again

<pre class="literal"> 
 $this->addElement('select', 'Currency', array(
    'label' => '/h',
    'multiOptions' => array('null' => 'Select...', 'EUR' => '€', 'GBP' => '£', 'USD' => '$' )


<pre class="literal"> 

What Id like is to be able to switch escaping off perhaps. I can see the need to do this on a per option basis. Providing a Euro symbol does not escape to €

Update : I found out how to do non formatted text so updated my example to be more accurate

Thanks :)


Posted by Loïc Frering (loic.frering) on 2008-12-01T03:33:12.000+0000

It would also be nice to render $nbsp; :)

Posted by Dan Entous (dan_nl) on 2009-05-04T19:21:35.000+0000

Is it possible to use utf-8 in your application and then use the actual € and £ symbols just like the $ symbol?

Posted by Matthew Weier O'Phinney (matthew) on 2009-05-05T05:31:22.000+0000

Tell Zend_View to use utf-8 encoding: $view->setEncoding('utf-8') if you want to use UTF-8 symbols directly.

As for the original reporter's issue, you can do this already. Pull the 'ViewHelper' decorator from the element, and set the 'escape' option to a boolean false:

<pre class="highlight">
$decorator = $multi->getDecorator('viewHelper');
$decorator->setOption('escape', false);

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.