Skip to content

Commit

Permalink
Send charset=UTF-8 if Content-Type is JSON.
Browse files Browse the repository at this point in the history
  • Loading branch information
frederikweber committed Nov 18, 2012
1 parent ac0b9b2 commit 9b47995
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/Cake/Network/CakeResponse.php
Expand Up @@ -409,8 +409,10 @@ protected function _setContentType() {
if (in_array($this->_status, array(304, 204))) { if (in_array($this->_status, array(304, 204))) {
return; return;
} }
if (strpos($this->_contentType, 'text/') === 0 || $this->_contentType === 'application/json') { if (strpos($this->_contentType, 'text/') === 0) {
$this->header('Content-Type', "{$this->_contentType}; charset={$this->_charset}"); $this->header('Content-Type', "{$this->_contentType}; charset={$this->_charset}");
} else if ($this->_contentType === 'application/json') {
$this->header('Content-Type', "{$this->_contentType}; charset=UTF-8");
} else { } else {
$this->header('Content-Type', "{$this->_contentType}"); $this->header('Content-Type', "{$this->_contentType}");
} }
Expand Down

0 comments on commit 9b47995

Please sign in to comment.