data/TWiki/VarENCODE.txt
changeset 0 414e01d06fd5
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/data/TWiki/VarENCODE.txt	Sat Jan 26 15:50:53 2008 +0100
     1.3 @@ -0,0 +1,22 @@
     1.4 +%META:TOPICINFO{author="TWikiContributor" date="1167874036" format="1.1" version="3"}%
     1.5 +%META:TOPICPARENT{name="TWikiVariables"}%
     1.6 +#VarENCODE
     1.7 +---+++ ENCODE{"string"} -- encodes a string to HTML entities
     1.8 +   * Encode "special" characters to HTML numeric entities. Encoded characters are:
     1.9 +      * all non-printable ASCII characters below space, except newline (="\n"=) and linefeed (="\r"=)
    1.10 +      * HTML special characters ="<"=, =">"=, ="&"=, single quote (='=) and double quote (="=)
    1.11 +      * TWiki special characters ="%"=, ="["=, ="]"=, ="@"=, ="_"=, ="*"=, ="="= and ="|"=
    1.12 +   * Syntax: =%<nop>ENCODE{"string"}%=
    1.13 +   * Supported parameters:
    1.14 +     | *Parameter:* | *Description:* | *Default:* |
    1.15 +     | ="string"= | String to encode | required (can be empty) |
    1.16 +     | =type="entity"= | Encode special characters into HTML entities, like a double quote into =&amp;#034;=. Does *not* encode =\n= or =\r=. | =type="url"= |
    1.17 +     | =type="html"= | As =type="entity"= except it also encodes =\n= and =\r= | =type="url"= |
    1.18 +     | =type="quotes"= | Escape double quotes with backslashes (=\"=), does not change other characters | =type="url"= |
    1.19 +     | =type="url"= | Encode special characters for URL parameter use, like a double quote into =%22= | (this is the default) |
    1.20 +   * Example: =%<nop>ENCODE{"spaced name"}%= expands to =%ENCODE{"spaced name"}%=
    1.21 +   * __%X% Note:__ Values of HTML input fields must be entity encoded.%BR% Example: =&lt;input type="text" name="address" value="%<nop>ENCODE{ "any text" type="entity" }%" /&gt;=
    1.22 +   * __%X% Note:__ Double quotes in strings must be escaped when passed into other TWiki variables.%BR% Example: =%<nop>SEARCH{ "%<nop>ENCODE{ "string with "quotes"" type="quotes" }%" noheader="on" }%=
    1.23 +
    1.24 +   * Related: [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables'" then="#"}%VarURLPARAM][URLPARAM]]
    1.25 +