Fix problem utf8 caracters special accents and ñ

Jan 29, 2013 at 2:17 PM
Edited Jan 29, 2013 at 2:27 PM

originally had problems with utf8 characters like accents and ñ not correctly wordphp codec. solve the problem with a simple function.

I leave if interested

Example:

 

function prepara_texto($texto)
{
        return html_entity_decode(iconv('UTF-8', 'windows-1252',$texto));
}

$document->setValue('nombre_completo', prepara_texto('Hugo morán es un niñon'));
$document->setValue('fecha', 'Hoy');
$document->setValue('correlativo', '2');
$document->setValue('contrato', '4545ij');
$document->setValue('socio', prepara_texto('Mars'));

Oct 8, 2014 at 6:01 AM
Thanks, you save me the day! :-)