Browse Source

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

frederikweber 13 years ago
parent
commit
9b479958f6
1 changed files with 3 additions and 1 deletions
  1. 3 1
      lib/Cake/Network/CakeResponse.php

+ 3 - 1
lib/Cake/Network/CakeResponse.php

@@ -409,8 +409,10 @@ class CakeResponse {
 		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}");
 		}