URL encoding
The task is to provide a function or mechanism to convert a provided string into url encoding representation.
URL encoding is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.
What is URL encoding?
In URL encoding, special characters, control characters and extended characters are converted into a percent symbol followed by a two digit hexadecimal code, So a space character encodes into %20 within the string.
The following characters require conversion:
- Ascii control codes (Character ranges 00-1F hex (0-31 decimal) and 7F (127 decimal).
- Extended characters with control codes of 128 and above.
- Ascii symbols (Character ranges 32-47 decimal (20-2F hex))
- Ascii symbols (Character ranges 58-64 decimal (3A-40 hex))
- Ascii symbols (Character ranges 91-96 decimal (5B-60 hex))
- Ascii symbols (Character ranges 123-126 decimal (7B-7E hex))
Example
The string "http://foo bar/" would be encoded as "http%25%2F%2Ffoo%20bar%2F"