2.2.2.1.1 WCTABLE

The WCTABLE tag marks the start of the mapping from Unicode UTF-16 to MultiByte bytes. It has one field.

Field 1: The number of records of Unicode to byte mappings. Note that this field is often more than the number of roundtrip mappings that are supported by the codepage due to Windows best-fit behavior.

An example of the WCTABLE tag is:

 WCTABLE 698

The Unicode UTF-16 mapping records follow the WCTABLE section. These mapping records are in two forms: single-byte or double-byte codepages. Both forms have two fields.

Field 1: The Unicode UTF-16 code point for the character being converted.

Field 2: The single byte that this UTF-16 code point maps to. This can be a best-fit mapping.

The following example shows Unicode to byte-mapping records for SBCSs.

  
 0x0000 0x00; Null
 0x0001 0x01; Start Of Heading
 ...
 0x0061 0x61; Latin Small Letter A
 0x0062 0x62; Latin Small Letter B
 0x0063 0x63; Latin Small Letter C
 ...
 0x221e 0x38; Infinity                        << Best Fit Mapping
 ...
 0xff41 0x61; Fullwidth Latin Small Letter A  << Best Fit Mapping
 0xff42 0x62; Fullwidth Latin Small Letter B  << Best Fit Mapping
 0xff43 0x63; Fullwidth Latin Small Letter C  << Best Fit Mapping
 ...

Field 1: The Unicode UTF-16 code point for the character being converted.

Field 2: The byte or bytes that this code point maps to as a 16-bit value. The high byte is the lead byte, and the low byte is the trail byte. If the high byte is 0, this is a single-byte code point with the value of the low byte and no lead byte is emitted.

The following example shows Unicode to byte-mapping records for DBCSs.

  
 0x0000 0x0000; Null
 0x0001 0x0001; Start Of Heading
 ...
 0x0061 0x0061; a
 0x0062 0x0062; b
 0x0063 0x0063; c
 ...
 0x221e 0x8187; Infinity
 ...
 0xff41 0x8281; Fullwidth a
 0xff42 0x8282; Fullwidth b
 0xff43 0x8283; Fullwidth c
 ...