The attributes of a specific UCS-2 character may be queried using either locale-specific or locale-independent functions.

Locale-specific functions

These functions query character attributes according to the rules defined by a particular locale.

The UniQueryCharAttr function is used to determine whether a character has the attribute(s) defined by the specified AttrObject.

In addition, the standard POSIX attributes may be queried using dedicated functions which are similar to the is* functions of the C character-type library, except that the attributes are localized according to the specified LocaleObject.

Finally, UniScanForAttr function may be used to search for characters within a UniChar string that match (either positively or negatively) the attributes defined by the specified AttrObject.

Locale-independent functions

These functions query character attributes independently of locale.

The UniQueryChar function is used to determine whether a character has the character-type attribute(s) defined by the specified identifier(s). This function may only be used to check for the standard POSIX or Win32 type attributes (CT_* or C1_*), which may be combined using bitwise OR syntax. An integer value of 0 or 1 is returned, depending on whether or not the character posses the specified attribute(s).

The UniQueryStringType function returns an array of USHORT values for the specified UniChar string, where each value in the array describes the attributes of a single character according to the specified category:

CT_ITYPE
Return POSIX (XPG/4) character type attributes. Test using CT_* identifiers.
CT_EXTENDED
Return extended (Unicode) charater type attributes. Test using C3_* identifiers.
CT_CHARSET
Return character set attributes. Test using CHS_* identifiers.
CT_BIDI
Return BiDi (layout) attributes. Test using C2_* identifiers.
CT_CODEPAGE
Return codepage information. Test using CCP_* identifiers.
CT_INDEX
Return information used by the character type table (in conjunction with UniQueryCharTypeTable).
CT_CTYPE1
Return POSIX character type attributes in a Win32-compatible format. Test using C1_* identifiers.
CT_CTYPE2
Return BiDi attributes in a Win32-compatible format. Test using C2_* identifiers.
CT_CTYPE3
Return extended character type attributes in a Win32-compatible format. Test using C3_* identifiers.

The UniQueryCharType function queries all the attributes of a specified UCS-2 character, and places the information in a UNICTYPE data structure. This structure contains information about character attributes in all categories:

typedef struct {  USHORT    itype;      /* POSIX character types mask (CT_*/C1_*) */
  CHAR      bidi;       /* BiDi attributes mask (C2_*)            */
  CHAR      charset;    /* Character sets mask (CHS_*)            */
  USHORT    extend;     /* Extended character types mask (C3_*)   */
  USHORT    codepage;   /* Codepages mask (CCP_*)                 */
} UNICTYPE;


[Back] [Next]