How to get unencoded data from browser to Spinneret server
ags
Posts: 386
Not sure if this is an HTTP or HTML question (or both). I have a rudimentary server running on my project (Prop1 & W5100 based - similar but not identical to the Spinneret). I created form with text input, which I want to use to pass ascii characters to the Prop. I'm using the GET method.
I now realize that anything other than standard alphanumeric characters are encoded by the browser (I presume) and when received on the Prop require decoding. Is there another way to get all printable characters sent using text input? I read a note about a different encoding, but that is only available using POST method.
Have others dealt with this? (I'm attempting to use a web interface instead of a serial terminal to provide access to functionality on the Prop, without PST and a serial connection) Is the recommended way to just implement a decoder for the encoded text, or use POST and (I think it's possible) avoid the encoding, or is there another way?
On final extra-credit challenge: how can I include a carriage return (CR) character? Some commands require a <cr>, some do not. I can do some post-processing on the Prop (server) side if needed, but wonder if there isn't some escape sequence to embed a carriage return in the text.
I now realize that anything other than standard alphanumeric characters are encoded by the browser (I presume) and when received on the Prop require decoding. Is there another way to get all printable characters sent using text input? I read a note about a different encoding, but that is only available using POST method.
Have others dealt with this? (I'm attempting to use a web interface instead of a serial terminal to provide access to functionality on the Prop, without PST and a serial connection) Is the recommended way to just implement a decoder for the encoded text, or use POST and (I think it's possible) avoid the encoding, or is there another way?
On final extra-credit challenge: how can I include a carriage return (CR) character? Some commands require a <cr>, some do not. I can do some post-processing on the Prop (server) side if needed, but wonder if there isn't some escape sequence to embed a carriage return in the text.
Comments
-Phil
I have implemented a form, using text input (and submit button) and it works as documented. The problem is that anything other than [a-z][A-Z][0-9] is encoded before sending. When I parse the string, all spaces are collapsed and replaced by a "+", and any other characters are encoded as a sequence %<ASCII value>. I can write code to parse and restore the string (other than any duplicate white spaces), but I'm wondering if there is a way to suppress the encoding (on the client side) as an easier way to deal with this. Has anyone run into this problem, and if so, how did you deal with it?
Thanks.
-Phil
So it does seem that this is a definitive answer to part of my question: it is not possible to defeat the encoding by text input in a form using the GET method. This is by design and necessity as the value is embedded in the URL and would otherwise cause problems.
Now I have to decide if it's worth implementing support for the POST method, just to avoid the encoding. I suspect it will just be easier to decode (unless there is some other benefit to using POST (or having support for POST for future use) or downside to using GET).
This method is part of a larger lib that tokenizes and enumerates an HTTP header.
http://code.google.com/p/propeller-w5200-driver/source/browse/trunk/%20propeller-w5200-driver/HttpHeader.spin
A proxy can be used to send data to the spinneret. The proxy handles the HTML and URL encoding then forwards the message to the Spinneret via UDP or TCP.