I have an issue where I’m doing this with AJAX
$('form').serialize()
I than convert it or "Unserialize" it with PHP using:
$params = array();
parse_str($_POST['data'], $params);
echo $params['name'];
I then use json_encode($params); and save to a file.
My issue is, when I use a character like ’ or - for example, it serialises it to \u2019 or \u2010 which I don't want, I want it stored as ’ or ‐ in JSON. I've tried absolutely everything to convert it.
I assume my point of conversion is on $params['name'] before being saved to JSON, I tried flags like JSON_UNESCAPED_UNICODE but this isn't it either. I don't have iconv or mb_ libraries to convert using those.
I believe the \u2019 is Unicode? and I need it converted to an HTML entity and then saved to JSON as an HTML entity.
I know this is very bizarre, but it’s for a very specific reason, and I’ve spent about 5 hours now on Google and I’m depleted.
I’ve come to the conclusion there is no native PHP function that’ll do it, but is there a function someone has written available? or do I need to get iconv or mb?