4.8 unicodedata -- Unicode Database
Keywords: lib

# 4.8 `unicodedata` -- Unicode Database

This module provides access to the Unicode Character Database which defines character properties for all Unicode characters. The data in this database is based on the UnicodeData.txt file version 3.0.0 which is publically available from ftp://ftp.unicode.org/.

The module uses the same names and symbols as defined by the UnicodeData File Format 3.0.0 (see http://www.unicode.org/Public/UNIDATA/UnicodeData.html). It defines the following functions:

`decimal` (unichr[, default])
  Returns the decimal value assigned to the Unicode character unichr as integer. If no such value is defined, default is returned, or, if not given, `ValueError` is raised.

`digit` (unichr[, default])
  Returns the digit value assigned to the Unicode character unichr as integer. If no such value is defined, default is returned, or, if not given, `ValueError` is raised.

`numeric` (unichr[, default])
  Returns the numeric value assigned to the Unicode character unichr as float. If no such value is defined, default is returned, or, if not given, `ValueError` is raised.

`category` (unichr)
  Returns the general category assigned to the Unicode character unichr as string.

`bidirectional` (unichr)
  Returns the bidirectional category assigned to the Unicode character unichr as string. If no such value is defined, an empty string is returned.

`combining` (unichr)
  Returns the canonical combining class assigned to the Unicode character unichr as integer. Returns `0` if no combining class is defined.

`mirrored` (unichr)
  Returns the mirrored property of assigned to the Unicode character unichr as integer. Returns `1` if the character has been identified as a ``mirrored'' character in bidirectional text, `0` otherwise.

`decomposition` (unichr)
  Returns the character decomposition mapping assigned to the Unicode character unichr as string. An empty string is returned in case no such mapping is defined.