Template:PN2HTP

From Wiki
Jump to: navigation, search

Template PN2HTP translates a poll name to an encoded value suitable for use in an HTTP query parameter. The poll name is the full name of a poll page. The translation is effected by replacing each slash '/' character with an exclamation mark '!'.1 The result is given a standard URL encoding (underscores for spaces, and so forth), though this should have no effect given the restrictions on a poll name. Usage:

{{PN2HTP | POLL NAME}}

For example:

{{PN2HTP | Tor/p/m}}

Yields the result:

Tor!p!m
  1. ^ “Within a query component, the characters ';', '/', '?', ':', '@', '&', '=', '+', ',', and '$' are reserved.”* We wanted to encoded the '/' as one of these (explicitly) unreserved “mark” characters: '-', '_', '.', '!', '~', '*', ''', '(' or ')'.** We chose the '!' which is otherwise invalid in a poll name. On their side, vote-servers and other poll-name parsers must decode it to '/'.