My php script is getting rows from a MySQL table that contain strings such as the following:
$string = 'ï¼’ã¤ã®ä¹³é…¸èŒã®ç¨';
Is there a way to echo these sorts of strings to the browser without getting "Forbidden code point" when running the document through an HTML5 validator?
I have tried the following:
htmlspecialchars($string);
htmlspecialchars($string, ENT_SUBSTITUTE, 'UTF-8');
htmlspecialchars($string, ENT_DISALLOWED, 'UTF-8');
htmlspecialchars(mb_convert_encoding($string, 'UTF-8');
but all of these expressions still result in the "Forbidden code point" error. The encoding of the webpage is already set to UTF-8 via a meta tag:
<meta charset="UTF-8">