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.
精彩评论