Thank you! This totally works! Ben
On Aug 4, 11:02 pm, Hrishikesh Bakshi <bakshi.hrishik...@gmail.com> wrote: > Use encodeURIComponent() instead of escape() for encoding your POST data. > > This will solve your issue. > > http://tinyurl.com/mcbgxg > > > > > > On Wed, Aug 5, 2009 at 1:00 AM, Bennomatic <readyass...@gmail.com> wrote: > > > OK, here's the last item on the list. I used my non-ajax form to save > > the data as a string as well, and now the + signs are being saved. > > > Should I not be escaping? Should I double-escape? Should I use a > > content type other than application/x-www-form-urlencoded? > > > Thanks for any guidance you can offer! > > > On Aug 4, 9:47 pm, Bennomatic <readyass...@gmail.com> wrote: > > > One other thing: I set up a form post option, so I was able to set up > > > the output to echo the input and the + signs are still there. It only > > > seems to be when I put those + signs into the datastore that they > > > become spaces or disappear. > > > > Haaaalp! (please?) > > > > On Aug 4, 9:28 pm, "readyass...@gmail.com" <readyass...@gmail.com> > > > wrote: > > > > > 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? > > -- > Hrishikesh Bakshi --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---