php - Converting Array Values from ISO-8859-1 to UTF8 for JSON Encoding -
i receive response web service, , values iso-8859-1 encoded. supplied library converts response array, , using json_encode
serialize response , store in database. it's mysql database, innodb engine, utf8 character set.
the encoding issue revealed warning in log:
php warning: json_encode(): invalid utf-8 sequence in argument in...
i know array key values alright because they're same , don't see warning every request.
is there downside using array_map
utf8_encode
rid of warnings?
json_encode(array_map('utf8_encode', $response))
you anyway need call systematically. go it.
Comments
Post a Comment