Tabs must also be escaped in JSON strings
If database table data contains tab characters (0x09) then those must also be escaped along with newlines and carriage returns for the resulting JSON file to be valid.
This commit is contained in:
parent
4c78976cba
commit
dedbd01f64
|
@ -243,7 +243,7 @@ function json_row($key, $val = null) {
|
||||||
echo "{";
|
echo "{";
|
||||||
}
|
}
|
||||||
if ($key != "") {
|
if ($key != "") {
|
||||||
echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
|
echo ($first ? "" : ",") . "\n\t\"" . addcslashes($key, "\r\n\t\"\\/") . '": ' . ($val !== null ? '"' . addcslashes($val, "\r\n\"\\/") . '"' : 'null');
|
||||||
$first = false;
|
$first = false;
|
||||||
} else {
|
} else {
|
||||||
echo "\n}\n";
|
echo "\n}\n";
|
||||||
|
|
Loading…
Reference in a new issue