PHP json encode – Malformed UTF-8 characters, possibly incorrectly encoded [duplicate]

The issue happens if there are some non-utf8 characters inside even though most of them are utf8 chars. This will remove any non-utf8 characters and now it works.

$data['name'] = mb_convert_encoding($data['name'], 'UTF-8', 'UTF-8');

Leave a Comment