while using json_decode, if there exist special charecter "question mark black diamond" decode returns empty values.
i have used utf-8 encode also.
your problem seems in json_encode part , not in json_decode part.
take @ this: how keep json_encode() dropping strings invalid characters
they suggest use iconv before json_encode string sure remove illegal characters.
to quote example given:
$stripped_of_invalid_utf8_chars_string = iconv('utf-8', 'utf-8//ignore', $orig_string); if ($stripped_of_invalid_utf8_chars_string !== $orig_string) { // 1 or more chars invalid, , stripped out. // if need know in string first stripped character was, // see https://stackoverflow.com/questions/7475437/find-first-character-that-is-different-between-two-strings } $json = json_encode($stripped_of_invalid_utf8_chars_string);
Comments
Post a Comment