Bug #20632 » 11361_typo3ajax_json_encode_v2.patch
typo3/classes/class.typo3ajax.php (working copy) | ||
---|---|---|
* @return void
|
||
*/
|
||
protected function renderAsJSON() {
|
||
// if the backend does not run in UTF-8 then we need to convert it to unicode as
|
||
// the json_encode method will return empty otherwise
|
||
if ($this->charset != $this->requestCharset) {
|
||
$GLOBALS['LANG']->csConvObj->convArray($this->content, $this->charset, $this->requestCharset);
|
||
}
|
||
$content = json_encode($this->content);
|
||
header('Content-type: application/json; charset='.$this->charset);
|
||
header('Content-type: application/json; charset='.$this->requestCharset);
|
||
header('X-JSON: '.($this->contentFormat != 'jsonbody' ? $content : true));
|
||
// bring content in xhr.responseText except when in "json head only" mode
|
||
... | ... | |
* @return void
|
||
*/
|
||
protected function renderAsJavascript() {
|
||
// if the backend does not run in UTF-8 then we need to convert it to unicode as
|
||
// the json_encode method will return empty otherwise
|
||
if ($this->charset != $this->requestCharset) {
|
||
$GLOBALS['LANG']->csConvObj->convArray($this->content, $this->charset, $this->requestCharset);
|
||
}
|
||
$content = '<script type="text/javascript">
|
||
/*<![CDATA[*/
|
||
... | ... | |
/*]]>*/
|
||
</script>';
|
||
header('Content-type: text/html; charset=' . $this->charset);
|
||
header('Content-type: text/html; charset=' . $this->requestCharset);
|
||
echo $content;
|
||
}
|
||
}
|
- « Previous
- 1
- 2
- Next »