2009年2月21日星期六

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

Hi everyone,

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 ?
Thanks.

--
My zend framework experience... the good, the bad
http://myzendframeworkexperience.blogspot.com/




Découvrez toutes les possibilités de communication avec vos proches

没有评论: