ZF-5081: Zend_View_Helper_FormSelect escaping html entities


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

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



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 :)


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

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

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:

$decorator = $multi->getDecorator('viewHelper');
$decorator->setOption('escape', false);