From 41952d2b259efdd89634aef7f47afc4cef6e7190 Mon Sep 17 00:00:00 2001 From: Steve Romanow Date: Wed, 18 May 2011 18:16:48 -0400 Subject: [PATCH] respect request charset Signed-off-by: Armin Ronacher --- flask/wrappers.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flask/wrappers.py b/flask/wrappers.py index 4db1e782..557ab841 100644 --- a/flask/wrappers.py +++ b/flask/wrappers.py @@ -73,7 +73,13 @@ class Request(RequestBase): if __debug__: _assert_have_json() if self.mimetype == 'application/json': - return json.loads(self.data) + request_charset = self.mimetype_params.get('charset') + if request_charset is not None: + j = json.loads(self.data, encoding=request_charset ) + else: + j = json.loads(self.data) + + return j class Response(ResponseBase):