Commit 633eb5ac authored by Christos Stavrakakis's avatar Christos Stavrakakis
Browse files

snf_django: Explicitly set encoding of requests

Explicitly set the request encoding to UTF-8 instead of relying to
the DEFAULT_CHARSET setting. See:
https://docs.djangoproject.com/en/1.4/ref/unicode/#form-submission
parent 8b489e97
...@@ -75,6 +75,11 @@ def api_method(http_method=None, token_required=True, user_required=True, ...@@ -75,6 +75,11 @@ def api_method(http_method=None, token_required=True, user_required=True,
@wraps(func) @wraps(func)
def wrapper(request, *args, **kwargs): def wrapper(request, *args, **kwargs):
try: try:
# Explicitly set request encoding to UTF-8 instead of relying
# to the DEFAULT_CHARSET setting. See:
# https://docs.djangoproject.com/en/1.4/ref/unicode/#form-submission
request.encoding = 'utf-8'
# Get the requested serialization format # Get the requested serialization format
serialization = get_serialization( serialization = get_serialization(
request, format_allowed, serializations[0]) request, format_allowed, serializations[0])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment