Help with decoding a post to HandleSpecialURL

Does anyone know how to decode the following content received in HandleSpecialURL in the WebRequest.Entity?
Thanks!
Bart

??–0xKhTmLbOuNdArY??Content-Disposition: form-data; name=“notes”???–0xKhTmLbOuNdArY??Content-Disposition: form-data; name=“checkedOutBy”???Grandmother??–0xKhTmLbOuNdArY??Content-Disposition: form-data; name=“checkoutDate”???2014-09-08 23:49:00??–0xKhTmLbOuNdArY??Content-Disposition: form-data; name=“checkoutByID”???–0xKhTmLbOuNdArY??Content-Disposition: form-data; name=“studentName”???Maxwell, Katherine??–0xKhTmLbOuNdArY??Content-Disposition: form-data; name=“sessionID”???702903D09E0A20ADF6CE88F5D3604FEC??–0xKhTmLbOuNdArY??Content-Disposition: form-data; name=“checkoutPhoto”???–0xKhTmLbOuNdArY–??

First, you want to set the encoding. Then use split with as separator the characters that appear as question marks in lozenges. Possibly EndOfLine.Windows (CR+LF), since they seem to come by pair .

the cause (&fix) is exactly the same as this blog post

http://www.xojo.com/blog/en/2013/08/why-are-there-diamonds-in-my-user-interface.php

Thanks! Define Encoding worked to get the correct characters.

However, it appears that in HandleSpecialURL, Xojo is completely removing the “Boundary” text and not storing it in a property that is accessible. For example, “Content-Type: multipart/form-data; boundary=0xKhTmLbOuNdArY” should be available to easily get the correct boundary.

Although - the best way to handle it would be for Xojo to recognize the multipart form-data and store fields in a dictionary :).

[quote=128163:@Bart Davis]Thanks! Define Encoding worked to get the correct characters.

However, it appears that in HandleSpecialURL, Xojo is completely removing the “Boundary” text and not storing it in a property that is accessible. For example, “Content-Type: multipart/form-data; boundary=0xKhTmLbOuNdArY” should be available to easily get the correct boundary.

Although - the best way to handle it would be for Xojo to recognize the multipart form-data and store fields in a dictionary :).[/quote]

Are you not getting all the post content ? I thought you had posted only an excerpt…

Storing in a dictionary seems fairly easy…

Absolutely not. We just changed away from this model across the board in 2014r2 because HTML can have multiple fields with the same name. It’s certainly legal to have 30 checkboxes with the exact same name which would be treated as an array in PHP or another language. And what would we do with files? they’ve got MIME type, file size, file name, etc. No we decided to leave the parsing of the content up to the developer so you can do what you need without us getting in the way.

Michel - Maybe I’m missing something, but I don’t see anywhere that I can access the entire post request? The content I posted above is all of the data from Entity. I tested with another development environment and a full, valid post is being sent from the client.

Greg - That makes sense. Is there any way to access the entire http post content)?

Look at the docs for WebRequest.

  • Entity contains the POST content.
  • QueryString contains the GET content (which was part of the URL)
  • Path contains the URL (minus the querystring)
  • Method contains the method used (GET, POST, PUT, etc…)

Parameters on the querystring are parsed into a dictionary and available with the GetParameter method. GetRequestHeader will allow you to access the incoming headers.

Thanks Greg. I didn’t realize that Boundary=xxx was available in the Content-Type header and was expecting it to be in Entity.