Name

charset_define — Define a character set.

Synopsis

charset_define ( in name varchar ,
in charset_string any ,
in aliases any );

Description

This function creates a new narrow language-specific character set, or redefines an existing one.

Parameters

name

The name of the character set to define. This becomes the "preferred" name of the character set.

charset_string

Wide string with the character codes for each given character from 1 to 255. That is, a 255-byte long NCHAR defining the Unicode codes for narrow chars 1-255.

aliases

Vector of character set names that are to be aliases of the character set being defined. Use NULL if there are to be no aliases.

Return Types

None

Errors

Table24.9.Errors signalled by

sqlstate error code error text
2C000 IN001 The UTF-8 is not a redefinable charset
2C000 IN002 charset_define : Charset table not a wide string
2C000 IN003 charset_define : 0 not allowed as a charset definition
2C000 IN004 charset <name> already defined. Drop it first
2C000 IN005 Alias <position> is not of type STRING

Examples

Example24.37.New 4th character, and aliases

To setup the 4th character to be Unicode 0xffce, and give the character set 2 aliases, you would make a call like this:

charset_define ('NEW-CHARSET',
      N'\x1\x2\x3\xffce\x5....' , vector ('SOME-CHARSET', 'ANOTHER-CHARSET'));

The character string should contain 255 wide characters that are arbitrary unicode values.