Active Web accepts server-side scripts and from them sends pages to the end user's browser. Both sides of this process involve streams of bytes being turned into characters. In order to retrieve the correct characters, then the encoding used to create the byte stream needs to be known.

Script File Encoding

The encoding that Active Web uses to read script files is decided quite simply.

  1. If nothing is explicitly set in the Active Web Console, use the server platform's default encoding.

  2. The encoding can be set in the Script File Encoding field in the Active Web Console, Config/General configuration page (see General Configuration). This overrides the platform default.

For example this allows a script server on a platform that normally uses 'SHIFT-JIS' (a Japanese language encoding) to process pages in English, using the 'UTF-8' encoding. It also allows multiple encodings to be processed on one platform, by setting up a new web application for each encoding.

HTML Page Encoding

The encoding that Active Web uses to send pages to the browser is decided in the following manner.

  1. If nothing is explicitly set in the following levels, use 'UTF-8', the normal encoding for Latin characters, used by most European languages.

  2. The encoding can be set in the Default HTTP Encoding field in the Active Web Console, Config/General configuration page.

  3. The encoding can be set in the individual scripts, so that a given page is always provided in a specified encoding, whatever the server/browser settings or in an encoding based on logic). This is done using the 'encoding' object. Also see the 'International Tokens' tutorial.

The above list clearly allows the script server to return a page in many encodings, based on different reasons.

Include Charset

The 'Include Charset' is a feature which affects the browser decoding.

This can be set to 'true' or 'false' in the Include Charset field in the Active Web Console, Config/General configuration page (see General Configuration). If set to 'true', all pages sent by the script server include information that tells the browser what encoding was used on the data. If set to 'false' the browser is left to find out for itself what encoding was used on the data.

On the face of it seems like a good idea to set this 'true', however some older browsers get confused by this field so it can be turned off if users are getting a problem displaying characters.

Summary

The following table gives a summary of the above behaviour.

Encoding Type

File Encoding

Http Encoding

Default

Platform Defined

Use UTF-8

Script Server default

Defined in Console

Defined in Console

Locale based

N/A

Use encoding defined in Console for browser locale

Script based

N/A

Encoding set by the script developer

Comment on this topic

Topic ID: 150039