aboutsummaryrefslogtreecommitdiffstats
path: root/rest_framework/response.py
diff options
context:
space:
mode:
authorTom Christie2013-05-20 21:00:56 +0100
committerTom Christie2013-05-20 21:00:56 +0100
commitf19e0d544fdcd318c2bde2057d91777beda78915 (patch)
tree16b48c2cca2fe887b7fd16247ebd6c6b9e172d70 /rest_framework/response.py
parent6fcffcc9c65d789b02c07372e3f4dd2f9ef5eba3 (diff)
downloaddjango-rest-framework-f19e0d544fdcd318c2bde2057d91777beda78915.tar.bz2
Fix charset issues
Diffstat (limited to 'rest_framework/response.py')
-rw-r--r--rest_framework/response.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/rest_framework/response.py b/rest_framework/response.py
index 32e74a45..3e0dd106 100644
--- a/rest_framework/response.py
+++ b/rest_framework/response.py
@@ -55,7 +55,11 @@ class Response(SimpleTemplateResponse):
else:
content_type = media_type
self['Content-Type'] = content_type
- return renderer.render(self.data, media_type, context)
+
+ ret = renderer.render(self.data, media_type, context)
+ if isinstance(ret, six.text_type):
+ return bytes(ret.encode(self.charset))
+ return ret
@property
def status_text(self):