Encoding AttributeMany value-returning meta tags accept an ENCODING attribute that determines how returned values are formatted. Each of the valid format types is described in this section. If no encoding attribute is specified, values returned by meta tags used in Results HTML, No Results HTML, and Error HTML undergo a process of conversion so they appear correctly in the user's Web browser. For example, < is converted to <. NONEThe NONE value for the ENCODING attribute allows you to indicate that the value returned by the meta tag contains HTML formatting codes that are to be passed back to the user's Web browser without translation. The main use for this attribute is for displaying HTML stored in database fields and variables. <@COLUMN NAME="pages.theHTMLpage" ENCODING="NONE">
METAHTMLThe METAHTML attribute value of the ENCODING attribute performs the same function as NONE but also looks for Tango meta tags in the value and evaluates any it finds. <@COLUMN NAME="table.template" ENCODING="METAHTML"> If the template column contains the text <@VAR NAME="foo">, the example shown returns the current value of the variable foo. MULTILINEThe MULTILINE attribute value causes Tango to replace return, line feed, and return/line feed combinations in the value with <BR> tags. Normally, Web browsers ignore line breaks in HTML. Use this attribute to force the display of returns in database values. MULTILINEHTMLThe MULTILINEHTML attribute value lets you combine the functions of NONE and MULTILINE. This formatting attribute is particularly useful for formatting data entered by users who have used HTML tags for character formatting (for example, bolding and italicization), but who have not used <BR> or <P> tags to properly indicate line or paragraph endings. URLThe URL formatting attribute value tells Tango to make the value returned by a meta tag safe for inclusion in a URL by encoding special characters such as spaces and slashes, according to the scheme set out in RFC 1630. The main use for this attribute value is to construct URLs containing database or user-entered values. <A HREF="/customer_detail?cust_name=
If the URL attribute were not used in this case, links to customer names from the database that contained spaces would not work properly because a space is invalid in a URL. By using the URL attribute value, any spaces are converted to %20. Similarly, other special characters that have meaning in URLs (~, #, and so on) are also converted. The <@URLENCODE> meta tag performs the same function on any value. It is strongly recommended that you get into the habit of encoding any meta tags included in a URL, even if you think the value returned is not going to require it. JAVASCRIPTEncodes the value to make it a valid JavaScript literal. It does this by escaping certain characters using a backslash; for example, tabs are converted to \t. Use this type of encoding when using a meta tag in server- or client-side JavaScript code. SQLThe SQL encoding type converts the specified value by doubling all occurrences of the single quote character. For more information, see "Direct DBMS SQL Auto-Encoding" in Chapter 18 of the User's Guide and "noSQLEncoding" . Tango Server automatically performs SQL encoding on meta tag values substituted in Direct DBMS SQL, except when the configuration variable noSQLEncoding is set to true. The SQL ENCODING attribute value is generally appropriate only when noSQLEncoding is set to true, and allows you to toggle SQL encoding on or off for particular meta tags. <@ASSIGN NAME=mySQL VALUE="SELECT * FROM customer WHERE cust_name=<@SQ>"> <@ASSIGN NAME=mySQL VALUE="<@ARG cust_name ENCODING=sql><@SQ>" |
Copyright © 1998, Pervasive Software Inc. All rights reserved.