PHP has built-in tools to convert the data to json. Consider this example:
echo json_encode(iconv('cp1251', 'utf-8', 'test'));
It will return "\\ u0442\\ u0435\\ u0441\\ u0442" (spaces so as not to tempt the parser) is 26 bytes, not 10 as I would like.
How so?