Special characters in form element #title I am trying to write a custom form for my own search facet. In the form, the labels of the elements are dinamically generated based on the indexed values, and they can contain special Hungarian characters, which are not displayed correctly. This is my code:

  $form['facets'][$current_property] = array(
    '#type' =&gt; 'select',
    '#title' =&gt; $current_property,
    '#multiple' =&gt; TRUE,
    '#options' =&gt; $myoptions,
    '#default_value' =&gt; $widget-&gt;buildDefaultValue($element),
    '#attributes' =&gt; array('class' =&gt; array('facetapi-multiselect', $form_state['facetapi_multiselect']['facet_class'])),
    '#post_render' =&gt; array('_facetapi_multiselect_modified_disable_options'),
    );      


So, for example, if $current_property is Belső memória/tárhely, then Bels? memória/tárhely is displayed in the search facet.

Can you suggest any ways how to do this correctly?
Thank you very much in advance.
Based on the version of drupal you are using, you can use one of functions below :

decode_entities($text) for Drupal 7


or

Html::decodeEntities($text) for Drupal 8


so in case of using drupal 7, Your code will looks like this:

$form['facets'][$current_property] = array(
  '#type' =&gt; 'select',
  '#title' =&gt; decode_entities($current_property),
  '#multiple' =&gt; TRUE,
  '#options' =&gt; $myoptions,
  '#default_value' =&gt; $widget-&gt;buildDefaultValue($element),
  '#attributes' =&gt; array('class' =&gt; array('facetapi-multiselect', 
    $form_state['facetapi_multiselect']['facet_class'])),
  '#post_render' =&gt; array('_facetapi_multiselect_modified_disable_options'),
);