开发者

Weird equal sign "=" inserts in <textarea> value when uploading file via POST using blobstore_handlers.BlobstoreUploadHandler on Google App Engine

Can only reproduce this issue on Google App Engine Server, not on my development server. Only when I copy-paste a part of web page to the <textarea>.

I searched Google App Engine forum and found two related posts, but still didn't figure it out. Can somebody give me more hint? Thanks!

Here is my code:

HTML

< form method = "post" action = "{% if action %}{{ action }}{% endif %}" enctype = "multipart/form-data" accept - charse开发者_高级运维t = "UTF-8" >
< textarea name = "textbox" id = "textbox" rows = "3" cols = "50" wrap = "soft" >

Python

t1 = self.request.get("textbox")
t2 = self.request.POST["textbox"]
logging.info("request get: %s, %s" % (t1, t2))

Related Posts: http://code.google.com/appengine/forum/python-forum.html?place=topic%2Fgoogle-appengine-python%2FOYfn9tXncUk%2Fdiscussion

http://code.google.com/appengine/forum/python-forum.html?place=topic%2Fgoogle-appengine-python%2FCsSrUmb7N4E%2Fdiscussion


Thanks to a hint on Google App Engine Forums from user Djidjadji I found that quopri.decodestring() helps me out! Here is the code I used. Hope it can save other dispirited programmers' time :)

tMessage = self.request.get("tMessage")

tMessage = quopri.decodestring(tMessage)

tMessage = " ".join(tMessage.split()) #Remove all whitespace

logging.info("tMessage: %s" % tMessage)


This is a bug in the outdated WebOb library of Google App Engine.

Just add add this newer version of WebOb in your app.yaml file.

libraries:
- name: webob
  version: "1.2.3"

The proposed quopri fix by Josh Caswell is only half the rent. It doesn't work with non-ascii characted.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜