Merge pull request #910 from franzliedke/patch-20

Force UTF-8 charset on JSON responses
This commit is contained in:
Taylor Otwell 2012-07-06 17:04:55 -07:00
commit dcf1966c28
1 changed files with 2 additions and 2 deletions

View File

@ -93,7 +93,7 @@ public static function view($view, $data = array())
*/ */
public static function json($data, $status = 200, $headers = array()) public static function json($data, $status = 200, $headers = array())
{ {
$headers['Content-Type'] = 'application/json'; $headers['Content-Type'] = 'application/json; charset=utf-8';
return new static(json_encode($data), $status, $headers); return new static(json_encode($data), $status, $headers);
} }
@ -113,7 +113,7 @@ public static function json($data, $status = 200, $headers = array())
*/ */
public static function eloquent($data, $status = 200, $headers = array()) public static function eloquent($data, $status = 200, $headers = array())
{ {
$headers['Content-Type'] = 'application/json'; $headers['Content-Type'] = 'application/json; charset=utf-8';
return new static(eloquent_to_json($data), $status, $headers); return new static(eloquent_to_json($data), $status, $headers);
} }