SlideServe
Menu
Préférences
© SlideServe · v2026

URL Encoding

Thomas avatar
6 diapositives · 637 Views · Sep 29, 2011

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

URL Encoding - slide 1
01 / 6URL Encoding
1 / 17

Télécharger la présentation

URL Encoding
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. 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

  2. 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.

  3. 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!

  4. testData.txt (This is what is passed to the parsing program) T1=A+New+Student&T3=Myhome@AnytownUSA&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

  5. field name: T1 field content: A New Student field name: T3 field content: Myhome@AnytownUSA 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