Saving data via PHP 5.5 on WAMP to MySQL saves fine.
Recalling it to the client via json_encode did work until I dropped and entered new data into my db. Then json_encode returned nothing
- no error - no data. No error in log file.
New data has German street names (with umlauts etc)
I replaced German street names with ascii codes.
json_encode worked as I expected, thus problem sort of resolved.
How does one resolve the issue going forward?
Data in my MySQL INNODB is saved as latin1.
Do I need to filter the data after read from DB, before calling json_encode ? Some other way?
Use below code:
mysql_query('SET CHARACTER SET utf8');
Before sql query,
And use below for json encode:
json_encode($array, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP | JSON_UNESCAPED_UNICODE)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.