Contracting conversion
A contracting conversion occurs when the length of the converted string is smaller than that of the source string.
For example, a contracting conversion occurs when an EBCDIC mixed data string that contains DBCS characters is converted to ASCII mixed. The contraction occurs because shift characters are removed. Contracting conversions can also occur when string data is converted to or from Unicode.
Contracting conversions typically affect European and Asian Pacific languages. For example, the German word straße contracts when it is converted from Unicode to ASCII or EBCDIC. Also, Japanese, Korean, and Chinese strings might contract when they are converted from EBCDIC to ASCII.
Contracting conversions can have the following effects on Db2:
- Contracting conversions can affect the results of the length functions, such as LENGTH, CHARACTER_LENGTH, SUBSTRING, and SUBSTR, on the converted string. For CHARACTER_LENGTH and SUBSTRING, use the CODEUNITS16 and CODEUNITS32 options to limit the effects of contracting conversions.
- Contracting conversions can affect the length of the object names, such as table names and column names. You can avoid these problems by not using special characters in object names.
To determine the worst-case result length of a CCSID conversion, use the table in Expanding conversion.
Examples
- Example
- In UTF-8 CCSID 1208, the character Å is represented by the code point X'C385'. In ASCII CCSID 819, this character is represented by X'C5'. Thus, the conversion of the character Å from CCSID 1208 to CCSID 819 is a contracting conversion.
- Example
- The German name Jürgen contracts when it is converted from Unicode to ASCII or EBCDIC and expands when it is converted from ASCII or EBCDIC to Unicode.