I have some info in my database. I subsequently echo json_encode($array);
the array in which the info is contained and return it to the page displaying the content via AJAX/jQuery.
For example;
"Dave's apples are sour".
My webpage displays it as:
"Dave’s apples are sour".
This is obviously a character encoding issue. we've never had issues until my hosting company was acquired by a different company.
The header of the page in which the content is displayed contains:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Since then we've tried the following:
mysqli_set_charset($conn, "utf8");
<- does not solve the problemecho json_encode( $array, JSON_UNESCAPED_UNICODE );
<- does not solve the problem
A echo mb_detect_encoding();
on the specific variable that contains "Dave's apples are sour" echoes: "UTF-8".
When examining the console of the page on which the info is displayed reveals that the content arrives to the script "messed up", FireBug shows the response literally being: Dave’s apples are sour.
The column in which the data is contained has the following structure:
ID, Name, Type, Collations
6, BlogPost, text, utf8_general_ci
Does anybody have some new insights? I have been searching for hours on StackOverflow without result.