(on Saturday, 21 February 2009, 01:09 PM +0100):
> I'd like to confirm a bug before posting it.
>
> I'm using this function to send back Json data :
>
> public function sendJson($data)
> {
> $this->_helper->viewRenderer->setNoRender();
> $this->getResponse()->setHeader('content-type', 'application/
> json');
> echo Zend_Json::encode($data);
> }
>
> However when I'm using a line break, the encoder fails to convert it to "\n" as
> it should normally.
>
> Is this normal ?
I've often sent back JSON payloads with line breaks without issue. To
narrow this issue down, is ext/json installed and enabled on your
server? (phpinfo will tell you this) That way we'll know if it's an
issue with ext/json or Zend_Json_Encoder. If ext/json is enabled, what
version of PHP are you using?
--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/
没有评论:
发表评论