Lasso Lite Logo

Character Encoding

HTML Character Encoding

The HTML standard requires that certain special characters and all non-ASCII extended characters (accented characters) be encoded in the following format:

&#nnn;

where "nnn" is the decimal value of the character. The special characters are right angle bracker (>), left angle bracker (<), quote ("), and ampersand (&). The non-ASCII extended characters are those with a decimal value greater than 127 (ASCII characters are in the range 0 to 127).

Lasso performs this character encoding when substituting field values specified by the [field: Field Name] tag in format files. If you have any of the four special characters in your field values and would like to have them interpreted as HTML tags, you'll need to turn off HTML character encoding for the specified field. This is done by adding the "raw" parameter to the [field] tag:

[field: Field Name, raw]

Note that if you turn off HTML coding in this manner, extended non-ASCII characters will also not be encoded. This may produce undesirable results depending on the browser. Therefore, you should avoid using extended characters in fields for which you intend to turn off HTML character encoding.

URL Character Encoding

The HTTP standard requires that all non-ASCII extended characters, reserved characters with special meaning, and certain "unsafe" characters be encoded in URLs in the following format:

%nn

where "nn" is the hexadecimal value of the character. The reserved characters are ";", "/", "?", ":", "@", "=", and "&". The unsafe characters are ">", "<", """, "#", "%", "{", "}", "|", "\", "^", "~", "[", "]", and "`". (Notice the square brackets used for Lasso special tags are considered unsafe in URLs and must be encoded).

If you are going to use field values in URLs (for example, inside an anchor or image tag), then you must tell Lasso to perform URL encoding rather that HTML encoding. This is done by adding the "url" parameter to the [field] tag:

<img src="[field: Field Name, url]">

Here's the tricky part: if your field contains a fully specified URL including reserved characters (i.e., "http://www.myserver.com/" ) then you don't want to do URL encoding. In this case, you want to specify "raw" so that no encoding is done at all.

Summary ("The Rules")

Lasso performs HTML encoding of all field values by default. This means that all text will be treated just as text. HTML tags will be ignored.

If you want to include HTML tags in your field values, then specify the "raw" parameter to the [field] tag to turn off HTML encoding.

If you want to include your field inside of a URL, then specify the "url" parameter to the [field] tag to specify URL encoding.

If your field value contains a URL, then specify the "raw" parameter to the [field] tag to turn off all encoding.

NOTE: Character encoding can dramatically affect performance on large text fields. For example: our tests show display of all 64k (FileMaker Pro maximum limit) of text at around 15 seconds with character encoding on (default and "URL" type) and at 1 second with it off (set to "raw").

© 1996 Blue World Communications, Inc.

Blue World logo