- json_encode: documentation ( source)
- iconv: documentation ( source)
<?php
$x = array();
$x["msg5"] = "yyy ผสมภาษาไทย zzz";
$x["sql"] = iconv("TIS-620", "UTF-8", "SELECT * FROM hell WHERE stage=2");
echo "<pre>", json_encode($x), "</pre>";