I've noticed a strange bug in my application, which has an AJAX
callback for saving form (textarea) content into a blob in the
database. The problem is that while everything else saves fine, any
'+' characters disappear.
I've added an alert to the AJAX save routine so I can see that, before
the save, the '+' is still in the string, and then the meat of the
callback is this:
http_request.open('post', xmlUrl, true);
http_request.setRequestHeader("Content-Type", "application/x-www-
form-urlencoded");
http_request.send('file_name=' + escape(file_name) +
'&file_content=' + escape(ta_content));
the "ta_content" variable is the TextArea content that I just verified
with the javascript alert.
This posts against a save routine which does the following:
class Save(webapp.RequestHandler):
def post(self):
#fn = self.request.get('file_name')
fc = self.request.get('file_content')
newfile = db.GqlQuery('SELECT * FROM Posts WHERE [yadda yadda]).get
()
if newfile is not None:
newfile.content = db.Blob(str(fc))
else:
newfile = Posts(content = db.Blob(str(fc)),
content_type = ct)
newfile.put()
self.response.out.write('<response>ok</response>')
And the DB entity is as follows:
class Posts(db.Model):
content = db.BlobProperty()
created = db.DateTimeProperty(auto_now_add=True)
#content2 = db.StringProperty()
So my question is, where are my '+' signs disappearing and how can I
stop this? I'm encoding my data on the post. I'm converting to a
string before storing to a blob on the AppEngine side. I even
temporarily added a string to the entity so that I could actually see
the data as it's stored in the datastore and guess what? I can see my
<,>,&,'," and everything else. Just no +.
Can anyone see what I'm doing wrong here, or does AppEngine just hate
me, plus signs or both?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---