django:处理编码的post请求

django:处理编码的post请求,django,encoding,post,Django,Encoding,Post,我正在将POST请求从客户端发送到应用程序。在服务器端,它的处理方式如下: def report(request): if request.method == "POST": dict = request.POST idea = dict["idea"] print idea return HttpResponse("Success") 如果idea=“binding”(或任何英文单词)我得到http 200 OK 但另一方面,如果是idea=“ззаа”(俄

我正在将POST请求从客户端发送到应用程序。在服务器端,它的处理方式如下:

def report(request):

if request.method == "POST":
    dict = request.POST
    idea = dict["idea"]
    print idea
    return HttpResponse("Success")
如果idea=“binding”(或任何英文单词)我得到http 200 OK

但另一方面,如果是idea=“ззаа”(俄语单词),我会得到500个错误

你能提出一个解决这个问题的方法吗


邮政字典示例:

<QueryDict: {u'tournament': [u''], u'sidetomove': [u'true'], 
u'idea': [u'\u0441\u0432\u044f\u0437\u043a\u0430']}>

您在打印
idea
时遇到错误。试试这个:

print repr(idea)

这很可能是由于UnicodeDecodeError造成的。

您在打印
idea
时遇到错误。试试这个:

print repr(idea)
这很可能是因为UnicodeDecodeError