When a character cannot be represented in the character set into which it is being converted, a substitution character is used instead. Conversions of this type are considered lossy; the original character is lost if it cannot be represented in the destination character set.
Also, not only may different character sets have a different substitution character, but the substitution character for one character set may be a non-substitution character in another character set. This is important to understand when multiple conversions are performed on a character because the final character may not appear as the expected substitution character of the destination character set.
For example, suppose that the client character set is Windows-1252, and the database character set is ISO_8859-1:1987, the U.S. default for some versions of Unix. Then, suppose a non-Unicode client application (for example, embedded SQL) attempts to insert the euro symbol into a CHAR, VARCHAR, or LONG VARCHAR column. Since the character does not exist in the CHAR character set, the substitution character for ISO_8859-1:1987, 0x1A, is inserted.
Now, if this same ISO_8859-1:1987 substitution character is then fetched as Unicode (for example, by doing a
SELECT * FROM t into a SQL_C_WCHAR bound column in ODBC), this character becomes the Unicode code point U+001A. (In Unicode the code point
U+001A is the record separator control character.) However, the substitution character for Unicode is the code point U+FFFD.
This example illustrates that even if your data contains substitution characters, those characters, due to multiple conversions,
may not be converted to the substitution character of the destination character set.
Therefore, it is important to understand and test how substitution characters are used when converting between multiple character sets.
The on_charset_conversion_failure option can help determine the behavior during conversion when a character cannot be represented in the destination character set. See on_charset_conversion_failure option [database].
|Send feedback about this page via email or DocCommentXchange||Copyright © 2008, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.0|