A character encoding is a technique for translating a sequence of bytes into a sequence of characters (text). For example, content from a Web page is stored on the server as a sequence of bytes and, when it is sent to a Web browser, it is converted to human-readable text using an appropriate character encoding. Different character encodings are available for handling the requirements of different languages; for example , languages such as English have a relatively small number of characters and can use a single-byte character set such as ISO-8859-1, which allows up to 256 symbols, including punctuation and accented characters. Other languages such as Chinese, however, use thousands of characters and require a double-byte character set such as Unicode, which allows up to 65536 symbols.

You can create internationalized Web sites with Dynamo in any character encodings supported by the Java Development Kit (JDK). Java bases all character data on Unicode. All Strings in Java are considered to be Unicode characters. Likewise, I/O classes support the conversion of character data to and from native encodings and Unicode.

Developers and Web designers generally use a native encoding method for their content. Dynamo handles native encoded content the same way Java does. When Dynamo reads in character data, it is converted to Unicode by the GenericConverter that is included with Dynamo. The GenericConverter handles any character encodings supported by Java and by your version of the JDK. Whenever data is written out and sent to a Web browser, the GenericConverter converts the data back to a native encoding. Typically, the encoding written out to a browser is the same as the encoding of the document that is read in by Dynamo. The Java InputStreamReader and OutputStreamWriter classes are used to convert text from locale-specific encoding to Unicode and then convert the text back to the locale-specific encoding for display to the user. For more information, see Using the EncodingTyper to Set the Character Encoding in this chapter.

loading table of contents...