Browse Source

Fixes #833: added charset to json response.

tags/2.0.0-beta
Qiang Xue 11 years ago
parent
commit
595ac6d0be
  1. 2
      framework/yii/web/Response.php

2
framework/yii/web/Response.php

@ -781,7 +781,7 @@ class Response extends \yii\base\Response
$this->content = $this->data; $this->content = $this->data;
break; break;
case self::FORMAT_JSON: case self::FORMAT_JSON:
$this->getHeaders()->set('Content-Type', 'application/json'); $this->getHeaders()->set('Content-Type', 'application/json; charset=' . $this->charset);
$this->content = Json::encode($this->data); $this->content = Json::encode($this->data);
break; break;
case self::FORMAT_JSONP: case self::FORMAT_JSONP:

Loading…
Cancel
Save