blob: 5096652f60a5c09628a7dceb4bbdafc63e18c9f1 [file] [log] [blame]
Fred Drake28b29442000-06-13 20:50:50 +00001\section{\module{unicodedata} ---
2 Unicode Database}
3
4\declaremodule{standard}{unicodedata}
5\modulesynopsis{Access the Unicode Database.}
6\moduleauthor{Marc-Andre Lemburg}{mal@lemburg.com}
7\sectionauthor{Marc-Andre Lemburg}{mal@lemburg.com}
8
9
10\index{Unicode}
11\index{character}
12\indexii{Unicode}{database}
13
14This module provides access to the Unicode Character Database which
15defines character properties for all Unicode characters. The data in
16this database is based on the \file{UnicodeData.txt} file version
173.0.0 which is publically available from \url{ftp://ftp.unicode.org/}.
18
19The module uses the same names and symbols as defined by the
20UnicodeData File Format 3.0.0 (see
Fred Drake6e1fecc2000-09-16 13:46:42 +000021\url{http://www.unicode.org/Public/UNIDATA/UnicodeData.html}). It
Fred Drake28b29442000-06-13 20:50:50 +000022defines the following functions:
23
Fredrik Lundh0110d3b2001-01-24 08:10:07 +000024\begin{funcdesc}{lookup}{name}
25 Look up character by name. If a character with the
26 given name is found, return the corresponding Unicode
27 character. If not found, \exception{KeyError} is raised.
28\end{funcdesc}
29
30\begin{funcdesc}{name}{unichr\optional{, default}}
31 Returns the name assigned to the Unicode character
32 \var{unichr} as a string. If no name is defined,
33 \var{default} is returned, or, if not given,
34 \exception{ValueError} is raised.
35\end{funcdesc}
36
Fred Drake28b29442000-06-13 20:50:50 +000037\begin{funcdesc}{decimal}{unichr\optional{, default}}
38 Returns the decimal value assigned to the Unicode character
39 \var{unichr} as integer. If no such value is defined,
40 \var{default} is returned, or, if not given,
41 \exception{ValueError} is raised.
42\end{funcdesc}
43
44\begin{funcdesc}{digit}{unichr\optional{, default}}
45 Returns the digit value assigned to the Unicode character
46 \var{unichr} as integer. If no such value is defined,
47 \var{default} is returned, or, if not given,
48 \exception{ValueError} is raised.
49\end{funcdesc}
50
51\begin{funcdesc}{numeric}{unichr\optional{, default}}
52 Returns the numeric value assigned to the Unicode character
53 \var{unichr} as float. If no such value is defined, \var{default} is
54 returned, or, if not given, \exception{ValueError} is raised.
55\end{funcdesc}
56
57\begin{funcdesc}{category}{unichr}
58 Returns the general category assigned to the Unicode character
59 \var{unichr} as string.
60\end{funcdesc}
61
62\begin{funcdesc}{bidirectional}{unichr}
63 Returns the bidirectional category assigned to the Unicode character
64 \var{unichr} as string. If no such value is defined, an empty string
65 is returned.
66\end{funcdesc}
67
68\begin{funcdesc}{combining}{unichr}
69 Returns the canonical combining class assigned to the Unicode
70 character \var{unichr} as integer. Returns \code{0} if no combining
71 class is defined.
72\end{funcdesc}
73
74\begin{funcdesc}{mirrored}{unichr}
75 Returns the mirrored property of assigned to the Unicode character
76 \var{unichr} as integer. Returns \code{1} if the character has been
77 identified as a ``mirrored'' character in bidirectional text,
78 \code{0} otherwise.
79\end{funcdesc}
80
81\begin{funcdesc}{decomposition}{unichr}
82 Returns the character decomposition mapping assigned to the Unicode
83 character \var{unichr} as string. An empty string is returned in case
84 no such mapping is defined.
85\end{funcdesc}