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');
More Related Contents:
- json_encode() non utf-8 strings?
- Reference: Why are my “special” Unicode characters encoded weird using json_encode?
- Detect encoding and make everything UTF-8
- How can I write a file in UTF-8 format?
- Why does the PHP json_encode function convert UTF-8 strings to hexadecimal entities?
- Convert utf8-characters to iso-88591 and back in PHP
- ‘Malformed UTF-8 characters, possibly incorrectly encoded’ in Laravel
- How to handle user input of invalid UTF-8 characters
- How can I detect a malformed UTF-8 string in PHP?
- PHP messing with HTML Charset Encoding
- PHP json_encode json_decode UTF-8
- utf-8 special characters not displaying [duplicate]
- Ensuring valid UTF-8 in PHP
- The ultimate emoji encoding scheme
- UTF8 Filenames in PHP and Different Unicode Encodings
- How to keep json_encode() from dropping strings with invalid characters
- How do I detect if have to apply UTF-8 decode or encode on a string?
- Reading JSON POST using PHP
- How to POST JSON Data With PHP cURL?
- PHP json_decode() returns NULL with valid JSON?
- php json_encode not working on arrays partially
- JavaScript: How do I create JSONP?
- Send post request using Volley and receive in PHP
- Getting ’ instead of an apostrophe(‘) in PHP
- Get a PHP object property that is a number [duplicate]
- Adding subscribers to a list using Mailchimp’s API v3
- jQuery $.ajax request of dataType json will not retrieve data from PHP script
- How to pass an array using PHP & Ajax to Javascript?
- Find JSON strings in a string
- How to decode a JSON String with several objects in PHP?