To convert special chars to their html entities strtr you can use strtr in conjunction with get_html_translation_table(HTML_ENTITIES) :
$trans = get_html_translation_table(HTML_ENTITIES);
$html_code = strtr($html_code, $trans);
This will replace in $html_code the ? by Á , etc.