Re: Proposed feature for json_encode()
| From: | Xuefer | Date: | Fri, 30 Nov 2007 02:16:07 +0000 |
| Subject: | Re: Proposed feature for json_encode() | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33537@lists.php.net to get a copy of this message | ||
if we want to
<a onclick="process(<?php echo json_encode($stringValue); ?>)">
we should do
echo htmlspecialchars(json_encode($stringValue)) instead actually, and
yes JSON_HEX_TAG will help avoiding htmlspecialchars() just like
urlencode()ed data which never contains < > or so.
i'm not sure if there is problem if you put json_encode()ed data in
<script> block without doing htmlspecialchars()