From db9f220f57f963a33d6f7e4405c2ef971787727a Mon Sep 17 00:00:00 2001 From: Franz Liedke Date: Sat, 7 Jul 2012 02:17:12 +0300 Subject: [PATCH] Force UTF-8 charset on JSON responses. --- laravel/response.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/laravel/response.php b/laravel/response.php index b6fa4d84..d86ee93e 100644 --- a/laravel/response.php +++ b/laravel/response.php @@ -93,7 +93,7 @@ public static function view($view, $data = 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); } @@ -113,7 +113,7 @@ public static function json($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); }