2009年2月22日星期日

Re: [fw-mvc] Zend JSON encoder / decode bug with line breaks (encoder won't convert to "\n")

-- Zladivliba Voskuy <nospampam@hotmail.fr> wrote
(on Sunday, 22 February 2009, 04:21 PM +0100):
> Yes, Json is enabled on the server and the version I use is : "json version
> 1.2.1 " ; for php it's 5.2.8. Maybe I can try to upgrade this ?

Should be fine - that's the latest version of each.

Can you give an example of the $data you're providing to sendJson(), so
I can see if I can reproduce the issue?


> > > 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/
>
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> Tous vos amis discutent sur Messenger, et vous ? T l chargez Messenger, c'est
> gratuit !

--
Matthew Weier O'Phinney
Software Architect | matthew@zend.com
Zend Framework | http://framework.zend.com/

没有评论: