Even though the majority of the characters are utf8 characters, the problem arises if there are any non-utf8 characters inside. Now that it's working, this will eliminate any non-UTF8 characters.
$data['name'] = mb_convert_encoding($data['name'], 'UTF-8', 'UTF-8');
I hope this helps you.