SyntaxFix
Write A Post
Hire A Developer
Questions
The illegal character is not in $matches[1], but in $xml
$matches[1]
$xml
Try
iconv($matches[1], 'utf-8//TRANSLIT', $xml);
And showing us the input string would be nice for a better answer.