Chinese sucks....
Took me a while to figure that out, but here is a solution that worked for me:
- Goto php.ini and change the default charset like so:
default_charset = "UTF-8"
- Restart the Server.
- Use mb_decode_numericentity like so:
$conn = new mysqli($dbHost, $dbUser, $dbPwd, $dbDb);
$sql = 'SELECT `chineseText` FROM tChineseText';
$stmt = $conn->prepare($sql);
$stmt->execute();
$stmt->bind_result($col1);
// important part starts here
$convmap = array(0xFF, 0x2FFFF, 0, 0xFFFF);
while($stmt->fetch()) {
echo mb_decode_numericentity($col1, $convmap, 'UTF-8');
}
This works when in the DB you store/retrieve the chinese characters encoded as ;助. Unfortunately I could not find a way to directly store or retrieve chinese to/from DB. Must be something about the DB server setting - and I didn't start fiddling with those.
Anyway: this solution works without too much changes to code or system, hope it helps.
Bjom