When a browser posts form data, there is no identifying field from the browser that indicates which encoding the data is in. The EncodingTyper determines the encoding of the data that is posted and provides a converter to convert the data from its native encoding to Unicode for use by an Oracle ATG Web Commerce application. Three EncodingTyper properties relate to the conversion of character data from a native encoding to Unicode: encodings, converters, and nullEncodings.

The encodings and converters properties map converter classes to specific encodings. Oracle ATG Web Commerce comes with two default converters, GenericConverter and JapaneseConverter. The GenericConverter simply converts the supplied native-encoded character data into Unicode. The JapaneseConverter is described in the next section.

JapaneseConverter

Some languages, for example Japanese, can use more than one encoding. In this case you need a language-specific converter that detects which encoding the characters are using by inspecting a sample of the characters. Oracle ATG Web Commerce includes a JapaneseConverter that you can use out-of-the-box. The JapaneseConverter gathers a sample of the incoming characters and determines whether their encoding is SJIS or EUC. In some situations, however, the converter lacks access to enough characters to be able to detect the encoding. For this reason, when you are using a converter such as the JapaneseConverter, make sure to change the fallbackEncoding attribute of the JapaneseConverter component from its default setting of NULL to a specific encoding that you want the converter to use as the default. If you do not change this attribute, the converter uses ASCII as the default encoding and your web browser cannot correctly display the page.

The nullEncodings property of the EncodingTyper component defines a list of encodings that do not require conversion. For example, ASCII maps directly into Unicode character for character. In other words, no conversion is necessary to make an ASCII string into a Unicode string. ASCII is therefore listed as a null encoding.


Copyright © 1997, 2013 Oracle and/or its affiliates. All rights reserved. Legal Notices