Search code examples
phpencoding

Cannot convert string in utf8


I have this string: Deportivo La Coruña, if I return it I'll get: Deportivo la coruña, so I tried to handle the encoding in this way:

$homeName = "Deportivo La Coruña";
return mb_convert_encoding($homeName, 'UTF-8', 'UTF-8'),

but same problem. I tried also utf8_encode but same result. How can I fix this issue without installing external libs?


Solution

  • I think the $homeName = "Deportivo La Coruña"; is in ISO-8859-1

    return mb_convert_encoding($homeName,  'ISO-8859-1' ,'UTF-8');
    

    Use this to achieve your result.