开发者

django: Processing encoded post request

I am sending POST request from client to the application. On the server side it processed this way:

def report(request):

if request.method == "POST":
    dict = request.POST
    idea = dict["idea"]
    print idea
    return HttpResponse("Success")

If idea = "binding" (or any English word) I get http 200 OK

but 开发者_开发百科on the other hand if idea = "связка" (Russian word), I am getting 500 Error

Could you please suggest a way to fix the issue?


Example of post dictionary:

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


You are getting an error while printing idea. Try this:

print repr(idea)

This is most probably because of a UnicodeDecodeError.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜