asked on
header('Content-Type: application/json; charset=utf-8;');
echo json_encode($this->response);
ASKER
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS Unicode Test</title>
</head>
<body>
<h1>JS Unicode Test</h1>
<script type="text/javascript">
<!--
document.write("This is \u00a3 .");
// -->
</script>
</body>
</html>
ASKER
ASKER
I'm outputting just json to the browserThere's your problem then. JSON is not valid HTML and if there is nothing on the page to support it like on my demo, it will be rendered in plain text with no recognition of UTF-8.
PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.
TRUSTED BY