Permalink
Browse files

Send charset=UTF-8 if Content-Type is JSON.

  • Loading branch information...
1 parent ac0b9b2 commit 9b479958f613e2ce1d290f26d246e76313e821f2 @frederikweber frederikweber committed Nov 18, 2012
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Cake/Network/CakeResponse.php
@@ -409,8 +409,10 @@ protected function _setContentType() {
if (in_array($this->_status, array(304, 204))) {
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}");
+ } else if ($this->_contentType === 'application/json') {
+ $this->header('Content-Type', "{$this->_contentType}; charset=UTF-8");
} else {
$this->header('Content-Type', "{$this->_contentType}");
}

0 comments on commit 9b47995

Please sign in to comment.