data/TWiki/VarENCODE.txt,v
changeset 0 414e01d06fd5
equal deleted inserted replaced
-1:000000000000 0:414e01d06fd5
       
     1 head	1.3;
       
     2 access;
       
     3 symbols;
       
     4 locks; strict;
       
     5 comment	@# @;
       
     6 
       
     7 
       
     8 1.3
       
     9 date	2008.01.22.03.21.30;	author TWikiContributor;	state Exp;
       
    10 branches;
       
    11 next	1.2;
       
    12 
       
    13 1.2
       
    14 date	2007.01.16.04.11.56;	author TWikiContributor;	state Exp;
       
    15 branches;
       
    16 next	1.1;
       
    17 
       
    18 1.1
       
    19 date	2006.06.25.16.26.28;	author TWikiContributor;	state Exp;
       
    20 branches;
       
    21 next	;
       
    22 
       
    23 
       
    24 desc
       
    25 @buildrelease
       
    26 @
       
    27 
       
    28 
       
    29 1.3
       
    30 log
       
    31 @buildrelease
       
    32 @
       
    33 text
       
    34 @%META:TOPICINFO{author="TWikiContributor" date="1167874036" format="1.1" version="3"}%
       
    35 %META:TOPICPARENT{name="TWikiVariables"}%
       
    36 #VarENCODE
       
    37 ---+++ ENCODE{"string"} -- encodes a string to HTML entities
       
    38    * Encode "special" characters to HTML numeric entities. Encoded characters are:
       
    39       * all non-printable ASCII characters below space, except newline (="\n"=) and linefeed (="\r"=)
       
    40       * HTML special characters ="<"=, =">"=, ="&"=, single quote (='=) and double quote (="=)
       
    41       * TWiki special characters ="%"=, ="["=, ="]"=, ="@@"=, ="_"=, ="*"=, ="="= and ="|"=
       
    42    * Syntax: =%<nop>ENCODE{"string"}%=
       
    43    * Supported parameters:
       
    44      | *Parameter:* | *Description:* | *Default:* |
       
    45      | ="string"= | String to encode | required (can be empty) |
       
    46      | =type="entity"= | Encode special characters into HTML entities, like a double quote into =&amp;#034;=. Does *not* encode =\n= or =\r=. | =type="url"= |
       
    47      | =type="html"= | As =type="entity"= except it also encodes =\n= and =\r= | =type="url"= |
       
    48      | =type="quotes"= | Escape double quotes with backslashes (=\"=), does not change other characters | =type="url"= |
       
    49      | =type="url"= | Encode special characters for URL parameter use, like a double quote into =%22= | (this is the default) |
       
    50    * Example: =%<nop>ENCODE{"spaced name"}%= expands to =%ENCODE{"spaced name"}%=
       
    51    * __%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;=
       
    52    * __%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" }%=
       
    53 
       
    54    * Related: [[%IF{"'%INCLUDINGTOPIC%'='TWikiVariables'" then="#"}%VarURLPARAM][URLPARAM]]
       
    55 
       
    56 @
       
    57 
       
    58 
       
    59 1.2
       
    60 log
       
    61 @buildrelease
       
    62 @
       
    63 text
       
    64 @d1 1
       
    65 a1 1
       
    66 %META:TOPICINFO{author="TWikiContributor" date="1167874036" format="1.2" version="2"}%
       
    67 a3 1
       
    68 
       
    69 d15 1
       
    70 a15 1
       
    71      | =type="quote"= | Escape double quotes with backslashes (=\"=), does not change other characters | =type="url"= |
       
    72 d21 1
       
    73 a21 1
       
    74    * Related: [[#VarURLPARAM][URLPARAM]]
       
    75 @
       
    76 
       
    77 
       
    78 1.1
       
    79 log
       
    80 @buildrelease
       
    81 @
       
    82 text
       
    83 @d1 1
       
    84 a1 1
       
    85 %META:TOPICINFO{author="TWikiContributor" date="1111929255" format="1.2" version="1"}%
       
    86 d14 3
       
    87 a16 1
       
    88      | =type="entity"= | Encode special characters into HTML entities, like a double quote into =&amp;#034;= | URL encoding |
       
    89 d19 3
       
    90 a21 1
       
    91    * __%X% Note:__ Values of HTML input fields must be entity encoded, for example:%BR% =&lt;input type="text" name="address" value="%<nop>ENCODE{ "any text" type="entity" }%" /&gt;=
       
    92 @