I’m using Zend_Form to create forms and I have an issue with the setLabel-function. I want to set the label using a variable: $value. The problem is that the $value (which is a string) contains some characters from the Norwegian alphabet (æøå). Because of the these characters the label shows as empty. Does anyone know how to fix this problem?
Example php code:
...
$checkbox = new Zend_Form_Element_Checkbox('someid');
$checkbox ->setLabel($value); //$value has value 'Håvard'.
...
Html output:
<dt id="someid-label"><label for="someid" class="optional"></label></dt>
<dd id="someid-element">
<input type="hidden" name="someid" value="0"><input type="checkbox" name="someid" id="someid" value="1"></dd>
It is an error in your application encoding. Please set anywhere UTF-8. I have tested with
$value = 'Håvard'and form renders with correct label.