Url encoding
Download
1 / 6

url encoding - PowerPoint PPT Presentation


  • 332 Views
  • Updated On :

URL Encoding. When data is entered on a Web page form, it must be encoded before it can be passed to some program for processing. Each element on the form has a name (key), and a value. Data is represented by a key-value pair. For example, a field representing age with a value of 30, would

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'url encoding' - Thomas


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Url encoding l.jpg
URL Encoding

When data is entered on a Web page form, it must be encoded

before it can be passed to some program for processing.

Each element on the form has a name (key), and a value.

Data is represented by a key-value pair.

For example, a field representing age with a value of 30, would

appear in the input stream as:

age=30


Url encoding rules l.jpg
URL Encoding Rules

  • Each key-value pair is separated by the ampersand (&) character.

  • Spaces are replaced with the plus sign (+) character.

  • All other special characters are replaced with their hexadecimal equivalent, in the form %nn.

A response of 01/22/2001 for today’s date would be: today=01%2F22%2F2001

since %2F is the hexadecimal equivalent of the

slash (/) character.


Slide3 l.jpg

Write a C++ program to parse a character string, as received from a web browser, into its component parts.

Following is a sample form, the resulting encoded string,

and the desired output. You should label and split the key-value pairs as shown.

Assume you have the character string available in a file

called testData.txt.

Don’t worry about the form itself, it is just for reference.

Don’t worry about the names of the elements (the keys) I used T1,T2,T3,S1,S2,S3 and B1 in my example.

This is simply a character string processing problem. All you need to know are the encoding rules!


Slide5 l.jpg

testData.txt from a web browser, into its component parts.

(This is what is passed to the parsing program)

T1=A+New+Student&[email protected]&T2=10-123-9898&S1=CIS111%2C+CIS115+%28The+Internet%29%2C+MAT100&S2=I+need+it+for+my+degree.&S3=I+am+interested+in+anything+to+do+with+the+Internet%21%21%0D%0AWill+there+be+many+programs+to+write+in+this+course%3F&B1=Submit


Slide6 l.jpg

field name: T1 from a web browser, into its component parts.

field content: A New Student

field name: T3

field content: [email protected]

field name: T2

field content: 10-123-9898

field name: S1

field content: CIS111, CIS115 (The Internet), MAT100

field name: S2

field content: I need it for my degree.

field name: S3

field content: I am interested in anything to do with the Internet!!

Will there be many programs to write in this course?

field name: B1

field content: Submit

Press any key to continue


ad