I have the following array:
Array
(
[BookDateID] => 4
[HotelName] => Adams’ Inn
)
Output:
{"BookDateID":"4","HotelName":null}
Any magic?
BTW, I have an alternative solution by looping thru each array and have them mb_convert_encoding(str,'HTML-ENTITIES') but I want the character remains the same as I have to insert this into a DB.
foreach($array as $key=>$value){
$array[$key] = mb_convert_encoding($value,'HTML-ENTITIES');
}
mb_convert_encodingby default usesmb_internal_encodingas source encoding, which by default isISO-8859-1. Trymb_detect_encoding($array["HotelName"],"UTF-8, ISO-8859-1")(or add other encoding according to your location) to see if the string is actually in UTF-8.