Ah indeed, the encoding is set on latin1_swedish, I’m gonna attempt the same while I’ve set it on utf8_general.
/edit
Alright, after setting it on utf8_general, it has reverted to "null".
{"success":true,"message":"","total":2,"data":[{"id":1,"short":"nl","long":"Nederland"},{"id":2,"short":"be","long":null}],"object":[]}
Notice the "long":null portion of the JSON? Well, that’s the problem. I’ve already tried;
- Table coalition change to utf8_general_ci or _unicode_ci
- Database coalition change to utf8_general_ci or _unicode_ci
- PHP Content-type json & utf8 charset above output
My installation is local, but that shouldn’t matter.
/edit
The following test scenario works fine;
echo '<pre>';
$countries = $this->modx->getCollection('testCountries');
header('Content-type: text/html; charset=ascii');
foreach($countries as $country) {
print_r($country->toArray());
}
exit();
But I do not want it to be encoded as ascii, but utf-8, since that’s the mainstream encoding.
/another edit
Fixed the MySQL charset from latin1 to utf8;
MySQL Karakterset: UTF-8 Unicode (utf8)
Translated: MySQL Charset: UTF-8 Unicode