Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
39
Task/URL-encoding/00-TASK.txt
Normal file
39
Task/URL-encoding/00-TASK.txt
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
;Task:
|
||||
Provide a function or mechanism to convert a provided string into URL encoding representation.
|
||||
|
||||
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.
|
||||
|
||||
For the purposes of this task, every character except 0-9, A-Z and a-z requires conversion, so the following characters all require conversion by default:
|
||||
|
||||
* ASCII control codes (Character ranges 00-1F hex (0-31 decimal) and 7F (127 decimal).
|
||||
* 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))
|
||||
* Extended characters with character codes of 128 decimal (80 hex) and above.
|
||||
|
||||
<br>
|
||||
;Example:
|
||||
The string "<code><nowiki>http://foo bar/</nowiki></code>" would be encoded as "<code><nowiki>http%3A%2F%2Ffoo%20bar%2F</nowiki></code>".
|
||||
|
||||
|
||||
;Variations:
|
||||
* Lowercase escapes are legal, as in "<code><nowiki>http%3a%2f%2ffoo%20bar%2f</nowiki></code>".
|
||||
* Special characters have different encodings for different standards:
|
||||
** RFC 3986, ''Uniform Resource Identifier (URI): Generic Syntax'', section 2.3, says to preserve "-._~".
|
||||
** HTML 5, section [http://www.whatwg.org/specs/web-apps/current-work/multipage/association-of-controls-and-forms.html#url-encoded-form-data 4.10.22.5 URL-encoded form data], says to preserve "-._*", and to encode space " " to "+".
|
||||
** [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI#description encodeURI] function in Javascript will preserve "-._~" (RFC 3986) and ";,/?:@&=+$!*'()#".
|
||||
|
||||
;Options:
|
||||
It is permissible to use an exception string (containing a set of symbols
|
||||
that do not need to be converted).
|
||||
However, this is an optional feature and is not a requirement of this task.
|
||||
|
||||
|
||||
;Related tasks:
|
||||
* [[URL decoding]]
|
||||
* [[URL parser]]
|
||||
<br><br>
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue