The Encoding Object

Before a script is executed the Active Web servlet creates an object called 'encoding' which contains encoding information for the HTTP response message.

This 'encoding' object allows the script to find out what the defaults will be for the delivery of this page and to modify them on a page basis. Any changes made to the 'encoding' object only affect the current delivery of the page.

Shown below is the encoding object prototype chain.

The encoding object is of class Encoding.

Encoding Object Properties

Both the currentValue and the charset properties are set to initial values by the script server before the start of every page. See Character set Encoding for more information on how the values are derived.

Property

Description

currentValue

The current HTTP character encoding. This is one of the supported HTTP encodings that will be used to encode characters sent to the browser.

If the script tries to change this for an encoding that is not supported then it will not be set and the error property will be set.

error

An error message If an error has occurred. If no error has occurred then it will be null. The error messages are explained below:

Unsupported encoding - An attempt has been made to set the currentValue to an encoding that is not supported.

includeCharset

True/false depending on whether the charset is to be included in the HTTP header (tells the browser what encoding is being used). Some browsers have a problem displaying data if the charset is included in the header so you can turn this off.

prototype

A reference to the Object Prototype. This property does not enumerate and can not be changed or deleted.

supportedEncodings

An array of all the encoding names supported by the server.

Encoding Object Functions

The encoding object has no predefined functions.

Comment on this topic

Topic ID: 150100