New API available to access Unicode DB, and RFC on changes to it.

[email protected] (Karl Williamson) Mon, 21 Nov 2011 14:19:27 -0700
Newsgroups perl.unicode
Message-ID <[email protected]>
--------------040705010800060903090304
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Repeat of last message, but now the attachment should be correct.

Perl 5.15.5, now available, has additions to Unicode::UCD in it to allow 
unfettered programmatic access to the Unicode character data base.  The 
API is quite similar to what was sent out for comment on this list 
several months ago; several changes were required as a result of lessons 
learned during implementation.  This email has an attachment that is an 
html file giving (with a yellow background) the additions since 5.14 to 
the pod.

As a result of this API, it is deprecated to read the files in 
lib/unicore directly.  These may change, and the API will be stable as 
of 5.16.  In the meantime, I'd be happy to have people use this, and 
give me get feedback on any problems with the API or bugs in the code.

And, I do wish to change the API already for certain of the outputs in 
prop_invmap() in order to make them more compact.  For example, take the 
uc() property.  What it currently returns is this (taken from the 
attached pod):

   @$uppers_ranges_ref    @$uppers_maps_ref   Note
         0                 "<code point>"
        97                     65          'a' maps to 'A'
        98                     66          'b' => 'B'
        99                     67          'c' => 'C'
        ...
       120                     88          'x' => 'X'
       121                     89          'y' => 'Y'
       122                     90          'z' => 'Z'
       123                "<code point>"
       181                    924          MICRO SIGN => Greek Cap MU
       182                "<code point>"
       ...
      0x0149              [ 0x02BC 0x004E ]
      0x014A              "<code point>"
      0x014B                 0x014A
       ...


That could be more compactly represented as:
   @$uppers_ranges_ref    @$uppers_maps_ref   Note
         0                      0
        97                    -32          'a-z' maps to 'A'-'Z'
       123                      0
       181                    743          MICRO SIGN => Greek Cap MU
       182                      0
       ...
      0x0149              [ 0x02BC 0x004E ]
      0x014A                    0
      0x014B                   -1
       ...

where the map is to be added to the code point to get the final result. 
   Thus only one entry is needed to represent all 26 ASCII lower case 
character mappings, instead of 26 entries.  This makes such tables 
significantly smaller.  The Perl core currently does a linear search 
through them looking for mappings.  Using the more compact versions 
would speed that up significantly.  The percentage gain is 30-40%, and 
with the mapping for decimal digits the result is a full order of 
magnitude smaller, making the search much much faster.

Returning the delta only makes sense on a few tables, ones that whose 
map is code points, or the decimal digits.

As you can see in the example for 0x0149, I wouldn't propose to make 
deltas of the lists, even though that is inconsistent.  They generally 
require special handling.


--------------040705010800060903090304
Content-Type: text/html; charset=ISO-8859-1;
 name="diff.htm"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
 filename="diff.htm"

<html><head><title>Unicode::UCD</title>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DISO-885=
9-1" >
</head>
<body class=3D'pod'>
<!--
  generated by Pod::Simple::HTML v3.19,
  using Pod::Simple::PullParser v3.19,
  under Perl v5.015005 at Mon Nov 21 20:58:33 2011 GMT.

 If you want to change this HTML document, you probably shouldn't do that=

   by changing it directly.  Instead, see about changing the calling opti=
ons
   to Pod::Simple::HTML, and/or subclassing Pod::Simple::HTML,
   then reconverting this document from the Pod source.
   When in doubt, email the author of Pod::Simple::HTML for advice.
   See 'perldoc Pod::Simple::HTML' for more info.

-->

<!-- start doc -->
<a name=3D'___top' class=3D'dummyTopAnchor' ></a>

<h1><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"NAME"
>NAME</a></h1>

<p>Unicode::UCD - Unicode character database</p>

<h1><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"SYNOPSIS"
>SYNOPSIS</a></h1>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>charinfo<font =
color=3D"gray">&#39;</font>;
    my $charinfo   =3D charinfo($codepoint);

    use Unicode::UCD <font color=3D"gray">&#39;</font>casefold<font color=
=3D"gray">&#39;</font>;
    my $casefold =3D casefold(0xFB00);

    use Unicode::UCD <font color=3D"gray">&#39;</font>casespec<font color=
=3D"gray">&#39;</font>;
    my $casespec =3D casespec(0xFB00);

    use Unicode::UCD <font color=3D"gray">&#39;</font>charblock<font colo=
r=3D"gray">&#39;</font>;
    my $charblock  =3D charblock($codepoint);

    use Unicode::UCD <font color=3D"gray">&#39;</font>charscript<font col=
or=3D"gray">&#39;</font>;
    my $charscript =3D charscript($codepoint);

    use Unicode::UCD <font color=3D"gray">&#39;</font>charblocks<font col=
or=3D"gray">&#39;</font>;
    my $charblocks =3D charblocks();

    use Unicode::UCD <font color=3D"gray">&#39;</font>charscripts<font co=
lor=3D"gray">&#39;</font>;
    my $charscripts =3D charscripts();

    use Unicode::UCD qw(charscript charinrange);
    my $range =3D charscript($script);
    print <font color=3D"gray">&#34;</font>looks like $script\n<font colo=
r=3D"gray">&#34;</font> if charinrange($range, $codepoint);

    use Unicode::UCD qw(general_categories bidi_types);
    my $categories =3D general_categories();
    my $types =3D bidi_types();

    <font style=3D"color: black; background: yellow">use Unicode::UCD &#3=
9;prop_aliases&#39;;</font>
    <font style=3D"color: black; background: yellow">my @space_names =3D =
prop_aliases(&#34;space&#34;);</font>

    <font style=3D"color: black; background: yellow">use Unicode::UCD &#3=
9;prop_value_aliases&#39;;</font>
    <font style=3D"color: black; background: yellow">my @gc_punct_names =3D=
 prop_value_aliases(&#34;Gc&#34;, &#34;Punct&#34;);</font>

    <font style=3D"color: black; background: yellow">use Unicode::UCD &#3=
9;prop_invlist&#39;;</font>
    <font style=3D"color: black; background: yellow">my @puncts =3D prop_=
invlist(&#34;gc=3Dpunctuation&#34;);</font>

    <font style=3D"color: black; background: yellow">use Unicode::UCD &#3=
9;prop_invmap&#39;;</font>
    <font style=3D"color: black; background: yellow">my ($list_ref, $map_=
ref, $format, $missing)</font>
                                      <font style=3D"color: black; backgr=
ound: yellow">=3D prop_invmap(&#34;General Category&#34;);</font>

    use Unicode::UCD <font color=3D"gray">&#39;</font>compexcl<font color=
=3D"gray">&#39;</font>;
    my $compexcl =3D compexcl($codepoint);

    use Unicode::UCD <font color=3D"gray">&#39;</font>namedseq<font color=
=3D"gray">&#39;</font>;
    my $namedseq =3D namedseq($named_sequence_name);

    my $unicode_version =3D Unicode::UCD::UnicodeVersion();

    my $convert_to_numeric =3D
              Unicode::UCD::num(<font color=3D"gray">&#34;</font>\N{RUMI =
DIGIT ONE}\N{RUMI DIGIT TWO}<font color=3D"gray">&#34;</font>);</pre>

<h1><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"DESCRIPTION"
>DESCRIPTION</a></h1>

<p>The Unicode::UCD module offers a series of functions that provide a si=
mple interface to the Unicode Character Database.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"code_point_argument"
>code point argument</a></h2>

<p>Some of the functions are called with a <i>code point argument</i>, wh=
ich is either a decimal or a hexadecimal scalar designating a Unicode cod=
e point, or <code>U+</code> followed by hexadecimals designating a Unicod=
e code point. In other words, if you want a code point to be interpreted =
as a hexadecimal number, you must prefix it with either <code>0x</code> o=
r <code>U+</code>, because a string like e.g. <code>123</code> will be in=
terpreted as a decimal code point. Note that the largest code point in Un=
icode is U+10FFFF.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"charinfo()"
><b>charinfo()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>charinfo<font =
color=3D"gray">&#39;</font>;

    my $charinfo =3D charinfo(0x41);</pre>

<p>This returns information about the input <a href=3D"#code_point_argume=
nt" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a> as a reference to a hash of fields as defined by the Un=
icode standard. If the <a href=3D"#code_point_argument" class=3D"podlinkp=
od"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a> is not assigned in the standard (i.e., has the general =
category <code>Cn</code> meaning <code>Unassigned</code>) or is a non-cha=
racter (meaning it is guaranteed to never be assigned in the standard), <=
code>undef</code> is returned.</p>

<p>Fields that aren<font color=3D"gray">&#39;</font>t applicable to the p=
articular code point argument exist in the returned hash, and are empty.<=
/p>

<p>The keys in the hash with the meanings of their values are:</p>

<dl>
<dt><a name=3D"code"
><b>code</b></a></dt>

<dd>
<p>the input <a href=3D"#code_point_argument" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a> expressed in hexadecimal, with leading zeros added if n=
ecessary to make it contain at least four hexdigits</p>

<dt><a name=3D"name"
><b>name</b></a></dt>

<dd>
<p>name of <i>code</i>, all IN UPPER CASE. Some control-type code points =
do not have names. This field will be empty for <code>Surrogate</code> an=
d <code>Private Use</code> code points, and for the others without a name=
, it will contain a description enclosed in angle brackets, like <code><f=
ont color=3D"gray">&#60;</font>control<font color=3D"gray">&#62;</font></=
code>.</p>

<dt><a name=3D"category"
><b>category</b></a></dt>

<dd>
<p>The short name of the general category of <i>code</i>. This will match=
 one of the keys in the hash returned by <a href=3D"#general_categories()=
" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>general_categories()<font color=3D"gray=
">&#34;</font></a>.</p>

<p><font style=3D"color: black; background: yellow">The</font> <a href=3D=
"#prop_value_aliases()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_value_aliases=
()&#34;</font></a> <font style=3D"color: black; background: yellow">funct=
ion can be used to get all the synonyms of the category name.</font></p>

<dt><a name=3D"combining"
><b>combining</b></a></dt>

<dd>
<p>the combining class number for <i>code</i> used in the Canonical Order=
ing Algorithm. For Unicode 5.1, this is described in Section 3.11 <code>C=
anonical Ordering Behavior</code> available at <a href=3D"http://www.unic=
ode.org/versions/Unicode5.1.0/" class=3D"podlinkurl"
>http://www.unicode.org/versions/Unicode5.1.0/</a></p>

<p><font style=3D"color: black; background: yellow">The</font> <a href=3D=
"#prop_value_aliases()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_value_aliases=
()&#34;</font></a> <font style=3D"color: black; background: yellow">funct=
ion can be used to get all the synonyms of the combining class number.</f=
ont></p>

<dt><a name=3D"bidi"
><b>bidi</b></a></dt>

<dd>
<p>bidirectional type of <i>code</i>. This will match one of the keys in =
the hash returned by <a href=3D"#bidi_types()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>bidi_types()<font color=3D"gray">&#34;<=
/font></a>.</p>

<p><font style=3D"color: black; background: yellow">The</font> <a href=3D=
"#prop_value_aliases()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_value_aliases=
()&#34;</font></a> <font style=3D"color: black; background: yellow">funct=
ion can be used to get all the synonyms of the bidi type name.</font></p>=


<dt><a name=3D"decomposition"
><b>decomposition</b></a></dt>

<dd>
<p>is empty if <i>code</i> has no decomposition; or is one or more codes =
(separated by spaces) that<font style=3D"color: black; background: yellow=
">,</font> taken in order<font style=3D"color: black; background: yellow"=
>,</font> represent a decomposition for <i>code</i>. Each has at least fo=
ur hexdigits. The codes may be preceded by a word enclosed in angle brack=
ets then a space, like <code>&ltcompa<font color=3D"gray">&#60;&#62;</fon=
t> </code>, giving the type of decomposition</p>

<p>This decomposition may be an intermediate one whose components are als=
o decomposable. Use <a href=3D"http://search.cpan.org/perldoc?Unicode%3A%=
3ANormalize" class=3D"podlinkpod"
>Unicode::Normalize</a> to get the final decomposition.</p>

<dt><a name=3D"decimal"
><b>decimal</b></a></dt>

<dd>
<p>if <i>code</i> is a decimal digit this is its integer numeric value</p=
>

<dt><a name=3D"digit"
><b>digit</b></a></dt>

<dd>
<p>if <i>code</i> represents some other digit-like number, this is its in=
teger numeric value</p>

<dt><a name=3D"numeric"
><b>numeric</b></a></dt>

<dd>
<p>if <i>code</i> represents a whole or rational number, this is its nume=
ric value. Rational values are expressed as a string like <code>1/4</code=
>.</p>

<dt><a name=3D"mirrored"
><b>mirrored</b></a></dt>

<dd>
<p><code>Y</code> or <code>N</code> designating if <i>code</i> is mirrore=
d in bidirectional text</p>

<dt><a name=3D"unicode10"
><b>unicode10</b></a></dt>

<dd>
<p>name of <i>code</i> in the Unicode 1.0 standard if one existed for thi=
s code point and is different from the current name</p>

<dt><a name=3D"comment"
><b>comment</b></a></dt>

<dd>
<p>As of Unicode 6.0, this is always empty.</p>

<dt><a name=3D"upper"
><b>upper</b></a></dt>

<dd>
<p>is empty if there is no single code point uppercase mapping for <i>cod=
e</i> (its uppercase mapping is itself); otherwise it is that mapping exp=
ressed as at least four hexdigits. (<a href=3D"#casespec()" class=3D"podl=
inkpod"
><font color=3D"gray">&#34;</font>casespec()<font color=3D"gray">&#34;</f=
ont></a> should be used in addition to <b>charinfo()</b> for case mapping=
s when the calling program can cope with multiple code point mappings.)</=
p>

<dt><a name=3D"lower"
><b>lower</b></a></dt>

<dd>
<p>is empty if there is no single code point lowercase mapping for <i>cod=
e</i> (its lowercase mapping is itself); otherwise it is that mapping exp=
ressed as at least four hexdigits. (<a href=3D"#casespec()" class=3D"podl=
inkpod"
><font color=3D"gray">&#34;</font>casespec()<font color=3D"gray">&#34;</f=
ont></a> should be used in addition to <b>charinfo()</b> for case mapping=
s when the calling program can cope with multiple code point mappings.)</=
p>

<dt><a name=3D"title"
><b>title</b></a></dt>

<dd>
<p>is empty if there is no single code point titlecase mapping for <i>cod=
e</i> (its titlecase mapping is itself); otherwise it is that mapping exp=
ressed as at least four hexdigits. (<a href=3D"#casespec()" class=3D"podl=
inkpod"
><font color=3D"gray">&#34;</font>casespec()<font color=3D"gray">&#34;</f=
ont></a> should be used in addition to <b>charinfo()</b> for case mapping=
s when the calling program can cope with multiple code point mappings.)</=
p>

<dt><a name=3D"block"
><b>block</b></a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">the </font>block <i>c=
ode</i> belongs to (used in <code>\p{Blk=3D...}</code>). See <a href=3D"#=
Blocks_versus_Scripts" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>Blocks versus Scripts<font color=3D"gra=
y">&#34;</font></a>.</p>

<dt><a name=3D"script"
><b>script</b></a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">the </font>script <i>=
code</i> belongs to. See <a href=3D"#Blocks_versus_Scripts" class=3D"podl=
inkpod"
><font color=3D"gray">&#34;</font>Blocks versus Scripts<font color=3D"gra=
y">&#34;</font></a>.</p>
</dd>
</dl>

<p>Note that you cannot do (de)composition and casing based solely on the=
 <i>decomposition</i>, <i>combining</i>, <i>lower</i>, <i>upper</i>, and =
<i>title</i> fields; you will need also the <a href=3D"#compexcl()" class=
=3D"podlinkpod"
><font color=3D"gray">&#34;</font>compexcl()<font color=3D"gray">&#34;</f=
ont></a>, and <a href=3D"#casespec()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>casespec()<font color=3D"gray">&#34;</f=
ont></a> functions.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"charblock()"
><b>charblock()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>charblock<font=
 color=3D"gray">&#39;</font>;

    my $charblock =3D charblock(0x41);
    my $charblock =3D charblock(1234);
    my $charblock =3D charblock(0x263a);
    my $charblock =3D charblock(<font color=3D"gray">&#34;</font>U+263a<f=
ont color=3D"gray">&#34;</font>);

    my $range     =3D charblock(<font color=3D"gray">&#39;</font>Armenian=
<font color=3D"gray">&#39;</font>);</pre>

<p>With a <a href=3D"#code_point_argument" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a> charblock() returns the <i>block</i> the code point bel=
ongs to, e.g. <code>Basic Latin</code>. <font style=3D"color: black; back=
ground: yellow">The old-style block name is returned (see</font> <a href=3D=
"#Old-style_versus_new-style_block_names" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font><font style=3D"color: black; background=
: yellow">Old-style versus new-style block names</font><font color=3D"gra=
y">&#34;</font></a><font style=3D"color: black; background: yellow">). </=
font>If the code point is unassigned, this returns the block it would bel=
ong to if it were assigned.</p>

<p>See also <a href=3D"#Blocks_versus_Scripts" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>Blocks versus Scripts<font color=3D"gra=
y">&#34;</font></a>.</p>

<p>If supplied with an argument that can<font color=3D"gray">&#39;</font>=
t be a code point, charblock() tries to do the opposite and interpret the=
 argument as <font style=3D"color: black; background: yellow">an old-styl=
e</font> block<font style=3D"color: black; background: yellow"> name</fon=
t>. The return value is a <i>range <font style=3D"color: black; backgroun=
d: yellow">set</font></i> <font style=3D"color: black; background: yellow=
">with one range</font>: an anonymous list <font style=3D"color: black; b=
ackground: yellow">with a single element</font> that <font style=3D"color=
: black; background: yellow">consists</font> of <font style=3D"color: bla=
ck; background: yellow">another anonymous list whose first element is the=
 first code point in the block</font>, <font style=3D"color: black; backg=
round: yellow">and whose second (and final) element is the final</font> c=
ode point <font style=3D"color: black; background: yellow">in the block</=
font>. <font style=3D"color: black; background: yellow">(The extra list c=
onsisting of just one element is so that the same program logic can be us=
ed to handle both this return, and the return from</font> <a href=3D"#cha=
rscript()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font><font style=3D"color: black; background=
: yellow">charscript()</font><font color=3D"gray">&#34;</font></a> <font =
style=3D"color: black; background: yellow">which can have multiple ranges=
=2E) </font>You can test whether a code point is in a range using the <a =
href=3D"#charinrange()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charinrange()<font color=3D"gray">&#34;=
</font></a> function. If the argument is not a known block, <code>undef</=
code> is returned.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"charscript()"
><b>charscript()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>charscript<fon=
t color=3D"gray">&#39;</font>;

    my $charscript =3D charscript(0x41);
    my $charscript =3D charscript(1234);
    my $charscript =3D charscript(<font color=3D"gray">&#34;</font>U+263a=
<font color=3D"gray">&#34;</font>);

    my $range      =3D charscript(<font color=3D"gray">&#39;</font>Thai<f=
ont color=3D"gray">&#39;</font>);</pre>

<p>With a <a href=3D"#code_point_argument" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a> charscript() returns the <i>script</i> the code point b=
elongs to, e.g. <code>Latin</code>, <code>Greek</code>, <code>Han</code>.=
 If the code point is unassigned, it returns <code><font color=3D"gray">&=
#34;</font><font style=3D"color: black; background: yellow">Unknown</font=
><font color=3D"gray">&#34;</font></code><font style=3D"color: black; bac=
kground: yellow">.</font></p>

<p>If supplied with an argument that can<font color=3D"gray">&#39;</font>=
t be a code point, charscript() tries to do the opposite and interpret th=
e argument as a script<font style=3D"color: black; background: yellow"> n=
ame</font>. The return value is a <i>range <font style=3D"color: black; b=
ackground: yellow">set</font></i>: an anonymous list of lists that contai=
n <i>start-of-range</i>, <i>end-of-range</i> code point pairs. You can te=
st whether a code point is in a range <font style=3D"color: black; backgr=
ound: yellow">set </font>using the <a href=3D"#charinrange()" class=3D"po=
dlinkpod"
><font color=3D"gray">&#34;</font>charinrange()<font color=3D"gray">&#34;=
</font></a> function. If the argument is not a known script, <code>undef<=
/code> is returned.</p>

<p>See also <a href=3D"#Blocks_versus_Scripts" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>Blocks versus Scripts<font color=3D"gra=
y">&#34;</font></a>.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"charblocks()"
><b>charblocks()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>charblocks<fon=
t color=3D"gray">&#39;</font>;

    my $charblocks =3D charblocks();</pre>

<p>charblocks() returns a reference to a hash with the known block names =
as the keys, and the code point ranges (see <a href=3D"#charblock()" clas=
s=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charblock()<font color=3D"gray">&#34;</=
font></a>) as the values.</p>

<p><font style=3D"color: black; background: yellow">The names are in the =
old-style (see</font> <a href=3D"#Old-style_versus_new-style_block_names"=
 class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;Old-style versus n=
ew-style block names&#34;</font></a><font style=3D"color: black; backgrou=
nd: yellow">).</font></p>

<p><a href=3D"#prop_invmap()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">prop_invmap(&#34;block&=
#34;)</font></a> <font style=3D"color: black; background: yellow">can be =
used to get this same data in a different type of data structure.</font><=
/p>

<p>See also <a href=3D"#Blocks_versus_Scripts" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>Blocks versus Scripts<font color=3D"gra=
y">&#34;</font></a>.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"charscripts()"
><b>charscripts()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>charscripts<fo=
nt color=3D"gray">&#39;</font>;

    my $charscripts =3D charscripts();</pre>

<p>charscripts() returns a reference to a hash with the known script name=
s as the keys, and the code point ranges (see <a href=3D"#charscript()" c=
lass=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charscript()<font color=3D"gray">&#34;<=
/font></a>) as the values.</p>

<p><a href=3D"#prop_invmap()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">prop_invmap(&#34;script=
&#34;)</font></a> <font style=3D"color: black; background: yellow">can be=
 used to get this same data in a different type of data structure.</font>=
</p>

<p>See also <a href=3D"#Blocks_versus_Scripts" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>Blocks versus Scripts<font color=3D"gra=
y">&#34;</font></a>.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"charinrange()"
><b>charinrange()</b></a></h2>

<p>In addition to using the <code>\p{Blk=3D...}</code> and <code>\P{Blk=3D=
=2E..}</code> constructs, you can also test whether a code point is in th=
e <i>range</i> as returned by <a href=3D"#charblock()" class=3D"podlinkpo=
d"
><font color=3D"gray">&#34;</font>charblock()<font color=3D"gray">&#34;</=
font></a> and <a href=3D"#charscript()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charscript()<font color=3D"gray">&#34;<=
/font></a> or as the values of the hash returned by <a href=3D"#charblock=
s()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charblocks()<font color=3D"gray">&#34;<=
/font></a> and <a href=3D"#charscripts()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charscripts()<font color=3D"gray">&#34;=
</font></a> by using charinrange():</p>

<pre>    use Unicode::UCD qw(charscript charinrange);

    $range =3D charscript(<font color=3D"gray">&#39;</font>Hiragana<font =
color=3D"gray">&#39;</font>);
    print <font color=3D"gray">&#34;</font>looks like hiragana\n<font col=
or=3D"gray">&#34;</font> if charinrange($range, $codepoint);</pre>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"general_categories()"
><b>general_categories()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>general_catego=
ries<font color=3D"gray">&#39;</font>;

    my $categories =3D general_categories();</pre>

<p>This returns a reference to a hash which has short general category na=
mes (such as <code>Lu</code>, <code>Nd</code>, <code>Zs</code>, <code>S</=
code>) as keys and long names (such as <code>UppercaseLetter</code>, <cod=
e>DecimalNumber</code>, <code>SpaceSeparator</code>, <code>Symbol</code>)=
 as values. The hash is reversible in case you need to go from the long n=
ames to the short names. The general category is the one returned from <a=
 href=3D"#charinfo()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charinfo()<font color=3D"gray">&#34;</f=
ont></a> under the <code>category</code> key.</p>

<p><font style=3D"color: black; background: yellow">The</font> <a href=3D=
"#prop_value_aliases()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_value_aliases=
()&#34;</font></a> <font style=3D"color: black; background: yellow">funct=
ion can be used to get all the synonyms of the category name.</font></p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"bidi_types()"
><b>bidi_types()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>bidi_types<fon=
t color=3D"gray">&#39;</font>;

    my $categories =3D bidi_types();</pre>

<p>This returns a reference to a hash which has the short bidi (bidirecti=
onal) type names (such as <code>L</code>, <code>R</code>) as keys and lon=
g names (such as <code>Left-to-Right</code>, <code>Right-to-Left</code>) =
as values. The hash is reversible in case you need to go from the long na=
mes to the short names. The bidi type is the one returned from <a href=3D=
"#charinfo()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charinfo()<font color=3D"gray">&#34;</f=
ont></a> under the <code>bidi</code> key. For the exact meaning of the va=
rious bidi classes the Unicode TR9 is recommended reading: <a href=3D"htt=
p://www.unicode.org/reports/tr9/" class=3D"podlinkurl"
>http://www.unicode.org/reports/tr9/</a> (as of Unicode 5.0.0)</p>

<p><font style=3D"color: black; background: yellow">The</font> <a href=3D=
"#prop_value_aliases()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_value_aliases=
()&#34;</font></a> <font style=3D"color: black; background: yellow">funct=
ion can be used to get all the synonyms of the bidi type name.</font></p>=


<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"compexcl()"
><b>compexcl()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>compexcl<font =
color=3D"gray">&#39;</font>;

    my $compexcl =3D compexcl(0x09dc);</pre>

<p>This routine is included for backwards compatibility, but as of Perl 5=
=2E12, for most purposes it is probably more convenient to use one of the=
 following instead:</p>

<pre>    my $compexcl =3D chr(0x09dc) =3D~ /\p{Comp_Ex};
    my $compexcl =3D chr(0x09dc) =3D~ /\p{Full_Composition_Exclusion};</p=
re>

<p>or even</p>

<pre>    my $compexcl =3D chr(0x09dc) =3D~ /\p{CE};
    my $compexcl =3D chr(0x09dc) =3D~ /\p{Composition_Exclusion};</pre>

<p>The first two forms return <b>true</b> if the <a href=3D"#code_point_a=
rgument" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a> should not be produced by composition normalization. <f=
ont style=3D"color: black; background: yellow">For the</font> final two f=
orms <font style=3D"color: black; background: yellow">to return</font> <b=
><font style=3D"color: black; background: yellow">true</font></b><font st=
yle=3D"color: black; background: yellow">, it is </font>additionally <fon=
t style=3D"color: black; background: yellow">required</font> that this fa=
ct not otherwise be determinable from the Unicode data base.</p>

<p>This routine behaves identically to the final two forms. That is, it d=
oes not return <b>true</b> if the code point has a decomposition consisti=
ng of another single code point, nor if its decomposition starts with a c=
ode point whose combining class is non-zero. Code points that meet either=
 of these conditions should also not be produced by composition normaliza=
tion, which is probably why you should use the <code>Full_Composition_Exc=
lusion</code> property instead, as shown above.</p>

<p>The routine returns <b>false</b> otherwise.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"casefold()"
><b>casefold()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>casefold<font =
color=3D"gray">&#39;</font>;

    my $casefold =3D casefold(0xDF);
    if (defined $casefold) {
        my @full_fold_hex =3D split / /, $casefold-<font color=3D"gray">&=
#62;</font>{<font color=3D"gray">&#39;</font>full<font color=3D"gray">&#3=
9;</font>};
        my $full_fold_string =3D
                    join <font color=3D"gray">&#34;</font><font color=3D"=
gray">&#34;</font>, map {chr(hex($_))} @full_fold_hex;
        my @turkic_fold_hex =3D
                        split / /, ($casefold-<font color=3D"gray">&#62;<=
/font>{<font color=3D"gray">&#39;</font>turkic<font color=3D"gray">&#39;<=
/font>} ne <font color=3D"gray">&#34;</font><font color=3D"gray">&#34;</f=
ont>)
                                        ? $casefold-<font color=3D"gray">=
&#62;</font>{<font color=3D"gray">&#39;</font>turkic<font color=3D"gray">=
&#39;</font>}
                                        : $casefold-<font color=3D"gray">=
&#62;</font>{<font color=3D"gray">&#39;</font>full<font color=3D"gray">&#=
39;</font>};
        my $turkic_fold_string =3D
                        join <font color=3D"gray">&#34;</font><font color=
=3D"gray">&#34;</font>, map {chr(hex($_))} @turkic_fold_hex;
    }
    if (defined $casefold <font color=3D"gray">&#38;</font><font color=3D=
"gray">&#38;</font> $casefold-<font color=3D"gray">&#62;</font>{<font col=
or=3D"gray">&#39;</font>simple<font color=3D"gray">&#39;</font>} ne <font=
 color=3D"gray">&#34;</font><font color=3D"gray">&#34;</font>) {
        my $simple_fold_hex =3D $casefold-<font color=3D"gray">&#62;</fon=
t>{<font color=3D"gray">&#39;</font>simple<font color=3D"gray">&#39;</fon=
t>};
        my $simple_fold_string =3D chr(hex($simple_fold_hex));
    }</pre>

<p>This returns the (almost) locale-independent case folding of the chara=
cter specified by the <a href=3D"#code_point_argument" class=3D"podlinkpo=
d"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a>.</p>

<p>If there is no case folding for that code point, <code>undef</code> is=
 returned.</p>

<p>If there is a case folding for that code point, a reference to a hash =
with the following fields is returned:</p>

<dl>
<dt><a name=3D"code"
><b>code</b></a></dt>

<dd>
<p>the input <a href=3D"#code_point_argument" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a> expressed in hexadecimal, with leading zeros added if n=
ecessary to make it contain at least four hexdigits</p>

<dt><a name=3D"full"
><b>full</b></a></dt>

<dd>
<p>one or more codes (separated by spaces) that<font style=3D"color: blac=
k; background: yellow">,</font> taken in order<font style=3D"color: black=
; background: yellow">,</font> give the code points for the case folding =
for <i>code</i>. Each has at least four hexdigits.</p>

<dt><a name=3D"simple"
><b>simple</b></a></dt>

<dd>
<p>is empty, or is exactly one code with at least four hexdigits which ca=
n be used as an alternative case folding when the calling program cannot =
cope with the fold being a sequence of multiple code points. If <i>full</=
i> is just one code point, then <i>simple</i> equals <i>full</i>. If ther=
e is no single code point folding defined for <i>code</i>, then <i>simple=
</i> is the empty string. Otherwise, it is an inferior, but still better-=
than-nothing alternative folding to <i>full</i>.</p>

<dt><a name=3D"mapping"
><b>mapping</b></a></dt>

<dd>
<p>is the same as <i>simple</i> if <i>simple</i> is not empty, and it is =
the same as <i>full</i> otherwise. It can be considered to be the simples=
t possible folding for <i>code</i>. It is defined primarily for backwards=
 compatibility.</p>

<dt><a name=3D"status"
><b>status</b></a></dt>

<dd>
<p>is <code>C</code> (for <code>common</code>) if the best possible fold =
is a single code point (<i>simple</i> equals <i>full</i> equals <i>mappin=
g</i>). It is <code>S</code> if there are distinct folds, <i>simple</i> a=
nd <i>full</i> (<i>mapping</i> equals <i>simple</i>). And it is <code>F</=
code> if there <font style=3D"color: black; background: yellow">is </font=
>only a <i>full</i> fold (<i>mapping</i> equals <i>full</i>; <i>simple</i=
> is empty). Note that this describes the contents of <i>mapping</i>. It =
is defined primarily for backwards compatibility.</p>

<p>On versions 3.1 and earlier of Unicode, <i>status</i> can also be <cod=
e>I</code> which is the same as <code>C</code> but is a special case for =
dotted uppercase I and dotless lowercase i:</p>

<dl>
<dt><a name=3D"*_If_you_use_this_I_mapping"
><b>*</b> If you use this <code>I</code> mapping</a></dt>

<dd>
<p>the result is case-insensitive, but dotless and dotted I<font color=3D=
"gray">&#39;</font>s are not distinguished</p>

<dt><a name=3D"*_If_you_exclude_this_I_mapping"
><b>*</b> If you exclude this <code>I</code> mapping</a></dt>

<dd>
<p>the result is not fully case-insensitive, but dotless and dotted I<fon=
t color=3D"gray">&#39;</font>s are distinguished</p>
</dd>
</dl>

<dt><a name=3D"turkic"
><b>turkic</b></a></dt>

<dd>
<p>contains any special folding for Turkic languages. For versions of Uni=
code starting with 3.2, this field is empty unless <i>code</i> has a diff=
erent folding in Turkic languages, in which case it is one or more codes =
(separated by spaces) that<font style=3D"color: black; background: yellow=
">,</font> taken in order<font style=3D"color: black; background: yellow"=
>,</font> give the code points for the case folding for <i>code</i> in th=
ose languages. Each code has at least four hexdigits. Note that this fold=
ing does not maintain canonical equivalence without additional processing=
=2E</p>

<p>For versions of Unicode 3.1 and earlier, this field is empty unless th=
ere is a special folding for Turkic languages, in which case <i>status</i=
> is <code>I</code>, and <i>mapping</i>, <i>full</i>, <i>simple</i>, and =
<i>turkic</i> are all equal.</p>
</dd>
</dl>

<p>Programs that want complete generality and the best folding results sh=
ould use the folding contained in the <i>full</i> field. But note that th=
e fold for some code points will be a sequence of multiple code points.</=
p>

<p>Programs that can<font color=3D"gray">&#39;</font>t cope with the fold=
 mapping being multiple code points can use the folding contained in the =
<i>simple</i> field, with the loss of some generality. In Unicode 5.1, ab=
out 7% of the defined foldings have no single code point folding.</p>

<p>The <i>mapping</i> and <i>status</i> fields are provided for backwards=
 compatibility for existing programs. They contain the same values as in =
previous versions of this function.</p>

<p>Locale is not completely independent. The <i>turkic</i> field contains=
 results to use when the locale is a Turkic language.</p>

<p>For more information about case mappings see <a href=3D"http://www.uni=
code.org/unicode/reports/tr21" class=3D"podlinkurl"
>http://www.unicode.org/unicode/reports/tr21</a></p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"casespec()"
><b>casespec()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>casespec<font =
color=3D"gray">&#39;</font>;

    my $casespec =3D casespec(0xFB00);</pre>

<p>This returns the potentially locale-dependent case mappings of the <a =
href=3D"#code_point_argument" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a>. The mappings may be longer than a single code point (w=
hich the basic Unicode case mappings as returned by <a href=3D"#charinfo(=
)" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charinfo()<font color=3D"gray">&#34;</f=
ont></a> never are).</p>

<p>If there are no case mappings for the <a href=3D"#code_point_argument"=
 class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a>, or if all three possible mappings (<i>lower</i>, <i>ti=
tle</i> and <i>upper</i>) result in single code points and are locale ind=
ependent and unconditional, <code>undef</code> is returned (which means t=
hat the case mappings, if any, for the code point are those returned by <=
a href=3D"#charinfo()" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>charinfo()<font color=3D"gray">&#34;</f=
ont></a>).</p>

<p>Otherwise, a reference to a hash giving the mappings (or a reference t=
o a hash of such hashes, explained below) is returned with the following =
keys and their meanings:</p>

<p>The keys in the bottom layer hash with the meanings of their values ar=
e:</p>

<dl>
<dt><a name=3D"code"
><b>code</b></a></dt>

<dd>
<p>the input <a href=3D"#code_point_argument" class=3D"podlinkpod"
><font color=3D"gray">&#34;</font>code point argument<font color=3D"gray"=
>&#34;</font></a> expressed in hexadecimal, with leading zeros added if n=
ecessary to make it contain at least four hexdigits</p>

<dt><a name=3D"lower"
><b>lower</b></a></dt>

<dd>
<p>one or more codes (separated by spaces) that<font style=3D"color: blac=
k; background: yellow">,</font> taken in order<font style=3D"color: black=
; background: yellow">,</font> give the code points for the lower case of=
 <i>code</i>. Each has at least four hexdigits.</p>

<dt><a name=3D"title"
><b>title</b></a></dt>

<dd>
<p>one or more codes (separated by spaces) that<font style=3D"color: blac=
k; background: yellow">,</font> taken in order<font style=3D"color: black=
; background: yellow">,</font> give the code points for the title case of=
 <i>code</i>. Each has at least four hexdigits.</p>

<dt><a name=3D"upper"
><b>upper</b></a></dt>

<dd>
<p>one or more codes (separated by spaces) that<font style=3D"color: blac=
k; background: yellow">,</font> taken in order<font style=3D"color: black=
; background: yellow">,</font> give the code points for the upper case of=
 <i>code</i>. Each has at least four hexdigits.</p>

<dt><a name=3D"condition"
><b>condition</b></a></dt>

<dd>
<p>the conditions for the mappings to be valid. If <code>undef</code>, th=
e mappings are always valid. When defined, this field is a list of condit=
ions, all of which must be true for the mappings to be valid. The list co=
nsists of one or more <i>locales</i> (see below) and/or <i>contexts</i> (=
explained in the next paragraph), separated by spaces. (Other than as use=
d to separate elements, spaces are to be ignored.) Case distinctions in t=
he condition list are not significant. Conditions preceded by <font color=
=3D"gray">&#34;</font>NON_<font color=3D"gray">&#34;</font> represent the=
 negation of the condition.</p>

<p>A <i>context</i> is one of those defined in the Unicode standard. For =
Unicode 5.1, they are defined in Section 3.13 <code>Default Case Operatio=
ns</code> available at <a href=3D"http://www.unicode.org/versions/Unicode=
5.1.0/" class=3D"podlinkurl"
>http://www.unicode.org/versions/Unicode5.1.0/</a>. These are for context=
-sensitive casing.</p>
</dd>
</dl>

<p>The hash described above is returned for locale-independent casing, wh=
ere at least one of the mappings has length longer than one. If <code>und=
ef</code> is returned, the code point may have mappings, but if so, all a=
re length one, and are returned by <a href=3D"#charinfo()" class=3D"podli=
nkpod"
><font color=3D"gray">&#34;</font>charinfo()<font color=3D"gray">&#34;</f=
ont></a>. Note that when this function does return a value, it will be fo=
r the complete set of mappings for a code point, even those whose length =
is one.</p>

<p>If there are additional casing rules that apply only in certain locale=
s, an additional key for each will be defined in the returned hash. Each =
such key will be its locale name, defined as a 2-letter ISO 3166 country =
code, possibly followed by a <font color=3D"gray">&#34;</font>_<font colo=
r=3D"gray">&#34;</font> and a 2-letter ISO language code (possibly follow=
ed by a <font color=3D"gray">&#34;</font>_<font color=3D"gray">&#34;</fon=
t> and a variant code). You can find the lists of all possible locales, s=
ee <a href=3D"http://search.cpan.org/perldoc?Locale%3A%3ACountry" class=3D=
"podlinkpod"
>Locale::Country</a> and <a href=3D"http://search.cpan.org/perldoc?Locale=
%3A%3ALanguage" class=3D"podlinkpod"
>Locale::Language</a>. (In Unicode 6.0, the only locales returned by this=
 function are <code>lt</code>, <code>tr</code>, and <code>az</code>.)</p>=


<p>Each locale key is a reference to a hash that has the form above, and =
gives the casing rules for that particular locale, which take precedence =
over the locale-independent ones when in that locale.</p>

<p>If the only casing for a code point is locale-dependent, then the retu=
rned hash will not have any of the base keys, like <code>code</code>, <co=
de>upper</code>, etc., but will contain only locale keys.</p>

<p>For more information about case mappings see <a href=3D"http://www.uni=
code.org/unicode/reports/tr21/" class=3D"podlinkurl"
>http://www.unicode.org/unicode/reports/tr21/</a></p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"namedseq()"
><b>namedseq()</b></a></h2>

<pre>    use Unicode::UCD <font color=3D"gray">&#39;</font>namedseq<font =
color=3D"gray">&#39;</font>;

    my $namedseq =3D namedseq(<font color=3D"gray">&#34;</font>KATAKANA L=
ETTER AINU P<font color=3D"gray">&#34;</font>);
    my @namedseq =3D namedseq(<font color=3D"gray">&#34;</font>KATAKANA L=
ETTER AINU P<font color=3D"gray">&#34;</font>);
    my %namedseq =3D namedseq();</pre>

<p>If used with a single argument in a scalar context, returns the string=
 consisting of the code points of the named sequence, or <code>undef</cod=
e> if no named sequence by that name exists. If used with a single argume=
nt in a list context, it returns the list of the ordinals of the code poi=
nts. If used with no arguments in a list context, returns a hash with the=
 names of the named sequences as the keys and the named sequences as stri=
ngs as the values. Otherwise, it returns <code>undef</code> or an empty l=
ist depending on the context.</p>

<p>This function only operates on officially approved (not provisional) n=
amed sequences.</p>

<p>Note that as of Perl 5.14, <code>\N{KATAKANA LETTER AINU P}</code> wil=
l insert the named sequence into double-quoted strings, and <code>charnam=
es::string_vianame(<font color=3D"gray">&#34;</font>KATAKANA LETTER AINU =
P<font color=3D"gray">&#34;</font>)</code> will return the same string th=
is function does, but will also operate on character names that aren<font=
 color=3D"gray">&#39;</font>t named sequences, without you having to know=
 which are which. See <a href=3D"http://search.cpan.org/perldoc?charnames=
" class=3D"podlinkpod"
>charnames</a>.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"num()"
><b><font style=3D"color: black; background: yellow">num()</font></b></a>=
</h2>

<pre>    <font style=3D"color: black; background: yellow">use Unicode::UC=
D &#39;num&#39;;</font>

    <font style=3D"color: black; background: yellow">my $val =3D num(&#34=
;123&#34;);</font>
    <font style=3D"color: black; background: yellow">my $one_quarter =3D =
num(&#34;\N{VULGAR FRACTION 1/4}&#34;);</font></pre>

<p><code>num</code> returns the numeric value of the input Unicode string=
; or <code>undef</code> if it doesn<font color=3D"gray">&#39;</font>t thi=
nk the entire string has a completely valid, safe numeric value.</p>

<p>If the string is just one character in length, the Unicode numeric val=
ue is returned if it has one, or <code>undef</code> otherwise. Note that =
this need not be a whole number. <code>num(<font color=3D"gray">&#34;</fo=
nt>\N{TIBETAN DIGIT HALF ZERO}<font color=3D"gray">&#34;</font>)</code>, =
for example returns -0.5.</p>

<p>If the string is more than one character, <code>undef</code> is return=
ed unless all its characters are decimal digits (that is<font style=3D"co=
lor: black; background: yellow">,</font> they would match <code>\d+</code=
>), from the same script. For example if you have an ASCII <font color=3D=
"gray">&#39;</font>0<font color=3D"gray">&#39;</font> and a Bengali <font=
 color=3D"gray">&#39;</font>3<font color=3D"gray">&#39;</font>, mixed tog=
ether, they aren<font color=3D"gray">&#39;</font>t considered a valid num=
ber, and <code>undef</code> is returned. A further restriction is that th=
e digits all have to be of the same form. A half-width digit mixed with a=
 full-width one will return <code>undef</code>. The Arabic script has two=
 sets of digits; <code>num</code> will return <code>undef</code> unless a=
ll the digits in the string come from the same set.</p>

<p><code>num</code> errs on the side of safety, and there may be valid st=
rings of decimal digits that it doesn<font color=3D"gray">&#39;</font>t r=
ecognize. Note that Unicode defines a number of <font color=3D"gray">&#34=
;</font>digit<font color=3D"gray">&#34;</font> characters that aren<font =
color=3D"gray">&#39;</font>t <font color=3D"gray">&#34;</font>decimal dig=
it<font color=3D"gray">&#34;</font> characters. <font color=3D"gray">&#34=
;</font>Decimal digits<font color=3D"gray">&#34;</font> have the property=
 that they have a positional value, i.e., there is a units position, a 10=
<font color=3D"gray">&#39;</font>s position, a 100<font color=3D"gray">&#=
39;</font>s, etc, AND they are arranged in Unicode in blocks of 10 contig=
uous code points. The Chinese digits, for example, are not in such a cont=
iguous block, and so Unicode doesn<font color=3D"gray">&#39;</font>t view=
 them as decimal digits, but merely digits, and so <code>\d</code> will n=
ot match them. A single-character string containing one of these digits w=
ill have its decimal value returned by <code>num</code>, but any longer s=
tring containing only these digits will return <code>undef</code>.</p>

<p>Strings of multiple sub- and superscripts are not recognized as number=
s. You can use either of the compatibility decompositions in Unicode::Nor=
malize to change these into digits, and then call <code>num</code> on the=
 result.</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"prop_aliases()"
><b><font style=3D"color: black; background: yellow">prop_aliases()</font=
></b></a></h2>

<pre>    <font style=3D"color: black; background: yellow">use Unicode::UC=
D &#39;prop_aliases&#39;;</font>

    <font style=3D"color: black; background: yellow">my ($short_name, $fu=
ll_name, @other_names) =3D prop_aliases(&#34;space&#34;);</font>
    <font style=3D"color: black; background: yellow">my $same_full_name =3D=
 prop_aliases(&#34;Space&#34;);     # Scalar context</font>
    <font style=3D"color: black; background: yellow">my ($same_short_name=
) =3D prop_aliases(&#34;Space&#34;);  # gets 0th element</font>
    <font style=3D"color: black; background: yellow">print &#34;The full =
name is $full_name\n&#34;;</font>
    <font style=3D"color: black; background: yellow">print &#34;The short=
 name is $short_name\n&#34;;</font>
    <font style=3D"color: black; background: yellow">print &#34;The other=
 aliases are: &#34;, join(&#34;, &#34;, @other_names), &#34;\n&#34;;</fon=
t>

    <font style=3D"color: black; background: yellow">prints:</font>
    <font style=3D"color: black; background: yellow">The full name is Whi=
te_Space</font>
    <font style=3D"color: black; background: yellow">The short name is WS=
pace</font>
    <font style=3D"color: black; background: yellow">The other aliases ar=
e: Space</font></pre>

<p><font style=3D"color: black; background: yellow">Most Unicode properti=
es have several synonymous names. Typically, there is at least a short na=
me, convenient to type, and a long name that more fully describes the pro=
perty, and hence is more easily understood.</font></p>

<p><font style=3D"color: black; background: yellow">If you know one name =
for a Unicode property, you can use</font> <code><font style=3D"color: bl=
ack; background: yellow">prop_aliases</font></code> <font style=3D"color:=
 black; background: yellow">to find either the long name (when called in =
scalar context), or a list of all of the names, somewhat ordered so that =
the short name is in the 0th element, the long name in the next element, =
and any other synonyms are in the remaining elements, in no particular or=
der.</font></p>

<p><font style=3D"color: black; background: yellow">The long name is retu=
rned in a form nicely capitalized, suitable for printing.</font></p>

<p><font style=3D"color: black; background: yellow">The input parameter n=
ame is loosely matched, which means that white space, hyphens, and unders=
cores are ignored (except for the trailing underscore in the old_form gra=
ndfathered-in</font> <code><font style=3D"color: black; background: yello=
w">&#34;L_&#34;</font></code><font style=3D"color: black; background: yel=
low">, which is better written as</font> <code><font style=3D"color: blac=
k; background: yellow">&#34;LC&#34;</font></code><font style=3D"color: bl=
ack; background: yellow">, and both of which mean</font> <code><font styl=
e=3D"color: black; background: yellow">General_Category=3DCased Letter</f=
ont></code><font style=3D"color: black; background: yellow">).</font></p>=


<p><font style=3D"color: black; background: yellow">If the name is unknow=
n,</font> <code><font style=3D"color: black; background: yellow">undef</f=
ont></code> <font style=3D"color: black; background: yellow">is returned =
(or an empty list in list context). Note that Perl typically recognizes p=
roperty names in regular expressions with an optional</font> <code><font =
style=3D"color: black; background: yellow">&#34;Is_</font></code><font st=
yle=3D"color: black; background: yellow">&#34; (with or without the under=
score) prefixed to them, such as</font> <code><font style=3D"color: black=
; background: yellow">\p{isgc=3Dpunct}</font></code><font style=3D"color:=
 black; background: yellow">. This function does not recognize those in t=
he input, returning</font> <code><font style=3D"color: black; background:=
 yellow">undef</font></code><font style=3D"color: black; background: yell=
ow">. Nor are they included in the output as possible synonyms.</font></p=
>

<p><code><font style=3D"color: black; background: yellow">prop_aliases</f=
ont></code> <font style=3D"color: black; background: yellow">does know ab=
out the Perl extensions to Unicode properties, such as</font> <code><font=
 style=3D"color: black; background: yellow">Any</font></code> <font style=
=3D"color: black; background: yellow">and</font> <code><font style=3D"col=
or: black; background: yellow">XPosixAlpha</font></code><font style=3D"co=
lor: black; background: yellow">, and the single form equivalents to Unic=
ode properties such as</font> <code><font style=3D"color: black; backgrou=
nd: yellow">XDigit</font></code><font style=3D"color: black; background: =
yellow">,</font> <code><font style=3D"color: black; background: yellow">G=
reek</font></code><font style=3D"color: black; background: yellow">,</fon=
t> <code><font style=3D"color: black; background: yellow">In_Greek</font>=
</code><font style=3D"color: black; background: yellow">, and</font> <cod=
e><font style=3D"color: black; background: yellow">Is_Greek</font></code>=
<font style=3D"color: black; background: yellow">. The final example demo=
nstrates that the</font> <code><font style=3D"color: black; background: y=
ellow">&#34;Is_&#34;</font></code> <font style=3D"color: black; backgroun=
d: yellow">prefix is recognized for these extensions; it is needed to res=
olve ambiguities. For example,</font> <code><font style=3D"color: black; =
background: yellow">prop_aliases(&#39;lc&#39;)</font></code> <font style=3D=
"color: black; background: yellow">returns the list</font> <code><font st=
yle=3D"color: black; background: yellow">(lc, Lowercase_Mapping)</font></=
code><font style=3D"color: black; background: yellow">, but</font> <code>=
<font style=3D"color: black; background: yellow">prop_aliases(&#39;islc&#=
39;)</font></code> <font style=3D"color: black; background: yellow">retur=
ns</font> <code><font style=3D"color: black; background: yellow">(Is_LC, =
Cased_Letter)</font></code><font style=3D"color: black; background: yello=
w">. This is because</font> <code><font style=3D"color: black; background=
: yellow">islc</font></code> <font style=3D"color: black; background: yel=
low">is a Perl extension which is short for</font> <code><font style=3D"c=
olor: black; background: yellow">General_Category=3DCased Letter</font></=
code><font style=3D"color: black; background: yellow">. The lists returne=
d for the Perl extensions will not include the</font> <code><font style=3D=
"color: black; background: yellow">&#34;Is_&#34;</font></code> <font styl=
e=3D"color: black; background: yellow">prefix (whether or not the input h=
ad it) unless needed to resolve ambiguities, as shown in the</font> <code=
><font style=3D"color: black; background: yellow">&#34;islc&#34;</font></=
code> <font style=3D"color: black; background: yellow">example, where the=
 returned list had one element containing</font> <code><font style=3D"col=
or: black; background: yellow">&#34;Is_&#34;</font></code><font style=3D"=
color: black; background: yellow">, and the other without.</font></p>

<p><font style=3D"color: black; background: yellow">It is also possible f=
or the reverse to happen:</font> <code><font style=3D"color: black; backg=
round: yellow">prop_aliases(&#39;isc&#39;)</font></code> <font style=3D"c=
olor: black; background: yellow">returns the list</font> <code><font styl=
e=3D"color: black; background: yellow">(isc, ISO_Comment)</font></code><f=
ont style=3D"color: black; background: yellow">; whereas</font> <code><fo=
nt style=3D"color: black; background: yellow">prop_aliases(&#39;c&#39;)</=
font></code> <font style=3D"color: black; background: yellow">returns</fo=
nt> <code><font style=3D"color: black; background: yellow">(C, Other)</fo=
nt></code> <font style=3D"color: black; background: yellow">(the latter b=
eing a Perl extension meaning</font> <code><font style=3D"color: black; b=
ackground: yellow">General_Category=3DOther</font></code><font style=3D"c=
olor: black; background: yellow">.</font> <a href=3D"http://search.cpan.o=
rg/perldoc?perluniprops#Properties_accessible_through_Unicode%3A%3AUCD" c=
lass=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;Properties accessi=
ble through Unicode::UCD&#34; in perluniprops</font></a> <font style=3D"c=
olor: black; background: yellow">lists the available forms, including whi=
ch ones are discouraged from use.</font></p>

<p><font style=3D"color: black; background: yellow">Those discouraged for=
ms are accepted as input to</font> <code><font style=3D"color: black; bac=
kground: yellow">prop_aliases</font></code><font style=3D"color: black; b=
ackground: yellow">, but are not returned in the lists.</font> <code><fon=
t style=3D"color: black; background: yellow">prop_aliases(&#39;isL&#38;&#=
39;)</font></code> <font style=3D"color: black; background: yellow">and</=
font> <code><font style=3D"color: black; background: yellow">prop_aliases=
(&#39;isL_&#39;)</font></code><font style=3D"color: black; background: ye=
llow">, which are old synonyms for</font> <code><font style=3D"color: bla=
ck; background: yellow">&#34;Is_LC&#34;</font></code> <font style=3D"colo=
r: black; background: yellow">and should not be used in new code, are exa=
mples of this. These both return</font> <code><font style=3D"color: black=
; background: yellow">(Is_LC, Cased_Letter)</font></code><font style=3D"c=
olor: black; background: yellow">. Thus this function allows you to take =
a discourarged form, and find its acceptable alternatives. The same goes =
with single-form Block property equivalences. Only the forms that begin w=
ith</font> <code><font style=3D"color: black; background: yellow">&#34;In=
_&#34;</font></code> <font style=3D"color: black; background: yellow">are=
 not discouraged; if you pass</font> <code><font style=3D"color: black; b=
ackground: yellow">prop_aliases</font></code> <font style=3D"color: black=
; background: yellow">a discouraged form, you will get back the equivalen=
t ones that begin with</font> <code><font style=3D"color: black; backgrou=
nd: yellow">&#34;In_&#34;</font></code><font style=3D"color: black; backg=
round: yellow">. It will otherwise look like a new-style block name (see.=
</font> <a href=3D"#Old-style_versus_new-style_block_names" class=3D"podl=
inkpod"
><font style=3D"color: black; background: yellow">&#34;Old-style versus n=
ew-style block names&#34;</font></a><font style=3D"color: black; backgrou=
nd: yellow">).</font></p>

<p><code><font style=3D"color: black; background: yellow">prop_aliases</f=
ont></code> <font style=3D"color: black; background: yellow">does not kno=
w about any user-defined properties, and will return</font> <code><font s=
tyle=3D"color: black; background: yellow">undef</font></code> <font style=
=3D"color: black; background: yellow">if called with one of those. Likewi=
se for Perl internal properties, with the exception of &#34;Perl_Decimal_=
Digit&#34; which it does know about (and which is documented below in</fo=
nt> <a href=3D"#prop_invmap()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_invmap()&#34;=
</font></a><font style=3D"color: black; background: yellow">).</font></p>=


<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"prop_value_aliases()"
><b><font style=3D"color: black; background: yellow">prop_value_aliases()=
</font></b></a></h2>

<pre>    <font style=3D"color: black; background: yellow">use Unicode::UC=
D &#39;prop_value_aliases&#39;;</font>

    <font style=3D"color: black; background: yellow">my ($short_name, $fu=
ll_name, @other_names)</font>
                                   <font style=3D"color: black; backgroun=
d: yellow">=3D prop_value_aliases(&#34;Gc&#34;, &#34;Punct&#34;);</font>
    <font style=3D"color: black; background: yellow">my $same_full_name =3D=
 prop_value_aliases(&#34;Gc&#34;, &#34;P&#34;);   # Scalar cntxt</font>
    <font style=3D"color: black; background: yellow">my ($same_short_name=
) =3D prop_value_aliases(&#34;Gc&#34;, &#34;P&#34;); # gets 0th</font>
                                                           <font style=3D=
"color: black; background: yellow"># element</font>
    <font style=3D"color: black; background: yellow">print &#34;The full =
name is $full_name\n&#34;;</font>
    <font style=3D"color: black; background: yellow">print &#34;The short=
 name is $short_name\n&#34;;</font>
    <font style=3D"color: black; background: yellow">print &#34;The other=
 aliases are: &#34;, join(&#34;, &#34;, @other_names), &#34;\n&#34;;</fon=
t>

    <font style=3D"color: black; background: yellow">prints:</font>
    <font style=3D"color: black; background: yellow">The full name is Pun=
ctuation</font>
    <font style=3D"color: black; background: yellow">The short name is P<=
/font>
    <font style=3D"color: black; background: yellow">The other aliases ar=
e: Punct</font></pre>

<p><font style=3D"color: black; background: yellow">Some Unicode properti=
es have a restricted set of legal values. For example, all binary propert=
ies are restricted to just</font> <code><font style=3D"color: black; back=
ground: yellow">true</font></code> <font style=3D"color: black; backgroun=
d: yellow">or</font> <code><font style=3D"color: black; background: yello=
w">false</font></code><font style=3D"color: black; background: yellow">; =
and there are only a few dozen possible General Categories.</font></p>

<p><font style=3D"color: black; background: yellow">For such properties, =
there are usually several synonyms for each possible value. For example, =
in binary properties,</font> <i><font style=3D"color: black; background: =
yellow">truth</font></i> <font style=3D"color: black; background: yellow"=
>can be represented by any of the strings &#34;Y&#34;, &#34;Yes&#34;, &#3=
4;T&#34;, or &#34;True&#34;; and the General Category &#34;Punctuation&#3=
4; by that string, or &#34;Punct&#34;, or simply &#34;P&#34;.</font></p>

<p><font style=3D"color: black; background: yellow">Like property names, =
there is typically at least a short name for each such property-value, an=
d a long name. If you know any name of the property-value, you can use</f=
ont> <code><font style=3D"color: black; background: yellow">prop_value_al=
iases</font></code><font style=3D"color: black; background: yellow">() to=
 get the long name (when called in scalar context), or a list of all the =
names, with the short name in the 0th element, the long name in the next =
element, and any other synonyms in the remaining elements, in no particul=
ar order, except that any all-numeric synonyms will be last.</font></p>

<p><font style=3D"color: black; background: yellow">The long name is retu=
rned in a form nicely capitalized, suitable for printing.</font></p>

<p><font style=3D"color: black; background: yellow">Case, white space, hy=
phens, and underscores are ignored in the input parameters (except for th=
e trailing underscore in the old-form grandfathered-in general category p=
roperty value</font> <code><font style=3D"color: black; background: yello=
w">&#34;L_&#34;</font></code><font style=3D"color: black; background: yel=
low">, which is better written as</font> <code><font style=3D"color: blac=
k; background: yellow">&#34;LC&#34;</font></code><font style=3D"color: bl=
ack; background: yellow">).</font></p>

<p><font style=3D"color: black; background: yellow">If either name is unk=
nown,</font> <code><font style=3D"color: black; background: yellow">undef=
</font></code> <font style=3D"color: black; background: yellow">is return=
ed. Note that Perl typically recognizes property names in regular express=
ions with an optional</font> <code><font style=3D"color: black; backgroun=
d: yellow">&#34;Is_</font></code><font style=3D"color: black; background:=
 yellow">&#34; (with or without the underscore) prefixed to them, such as=
</font> <code><font style=3D"color: black; background: yellow">\p{isgc=3D=
punct}</font></code><font style=3D"color: black; background: yellow">. Th=
is function does not recognize those in the property parameter, returning=
</font> <code><font style=3D"color: black; background: yellow">undef</fon=
t></code><font style=3D"color: black; background: yellow">.</font></p>

<p><font style=3D"color: black; background: yellow">If called with a prop=
erty that doesn&#39;t have synonyms for its values, it returns the input =
value, possibly normalized with capitalization and underscores.</font></p=
>

<p><font style=3D"color: black; background: yellow">For the block propert=
y, new-style block names are returned (see</font> <a href=3D"#Old-style_v=
ersus_new-style_block_names" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;Old-style versus n=
ew-style block names&#34;</font></a><font style=3D"color: black; backgrou=
nd: yellow">).</font></p>

<p><font style=3D"color: black; background: yellow">To find the synonyms =
for single-forms, such as</font> <code><font style=3D"color: black; backg=
round: yellow">\p{Any}</font></code><font style=3D"color: black; backgrou=
nd: yellow">, use</font> <a href=3D"#prop_aliases()" class=3D"podlinkpod"=

><font style=3D"color: black; background: yellow">&#34;prop_aliases()&#34=
;</font></a> <font style=3D"color: black; background: yellow">instead.</f=
ont></p>

<p><code><font style=3D"color: black; background: yellow">prop_value_alia=
ses</font></code> <font style=3D"color: black; background: yellow">does n=
ot know about any user-defined properties, and will return</font> <code><=
font style=3D"color: black; background: yellow">undef</font></code> <font=
 style=3D"color: black; background: yellow">if called with one of those.<=
/font></p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"prop_invlist()"
><b><font style=3D"color: black; background: yellow">prop_invlist()</font=
></b></a></h2>

<p><code><font style=3D"color: black; background: yellow">prop_invlist</f=
ont></code> <font style=3D"color: black; background: yellow">returns an i=
nversion list (described below) that defines all the code points for the =
binary Unicode property (or &#34;property=3Dvalue&#34; pair) given by the=
 input parameter string:</font></p>

<pre> <font style=3D"color: black; background: yellow">use feature &#39;s=
ay&#39;;</font>
 <font style=3D"color: black; background: yellow">use Unicode::UCD &#39;p=
rop_invlist&#39;;</font>
 <font style=3D"color: black; background: yellow">say join &#34;, &#34;, =
prop_invlist(&#34;Any&#34;);</font>

 <font style=3D"color: black; background: yellow">prints:</font>
 <font style=3D"color: black; background: yellow">0, 1114112</font></pre>=


<p><font style=3D"color: black; background: yellow">An empty list is retu=
rned if the input is unknown; the number of elements in the list is retur=
ned if called in scalar context.</font></p>

<p><a href=3D"http://search.cpan.org/perldoc?perluniprops#Properties_acce=
ssible_through_%5Cp%7B%7D_and_%5CP%7B%7D" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">perluniprops</font></a>=
 <font style=3D"color: black; background: yellow">gives the list of prope=
rties that this function accepts, as well as all the possible forms for t=
hem (including with the optional &#34;Is_&#34; prefixes). (Except this fu=
nction doesn&#39;t accept any Perl-internal properties, some of which are=
 listed there.) This function uses the same loose or tighter matching rul=
es for resolving the input property&#39;s name as is done for regular exp=
ressions. These are also specified in</font> <a href=3D"http://search.cpa=
n.org/perldoc?perluniprops#Properties_accessible_through_%5Cp%7B%7D_and_%=
5CP%7B%7D" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">perluniprops</font></a>=
<font style=3D"color: black; background: yellow">. Examples of using the =
&#34;property=3Dvalue&#34; form are:</font></p>

<pre> <font style=3D"color: black; background: yellow">say join &#34;, &#=
34;, prop_invlist(&#34;Script=3DShavian&#34;);</font>

 <font style=3D"color: black; background: yellow">prints:</font>
 <font style=3D"color: black; background: yellow">66640, 66688</font>

 <font style=3D"color: black; background: yellow">say join &#34;, &#34;, =
prop_invlist(&#34;ASCII_Hex_Digit=3DNo&#34;);</font>

 <font style=3D"color: black; background: yellow">prints:</font>
 <font style=3D"color: black; background: yellow">0, 48, 58, 65, 71, 97, =
103</font>

 <font style=3D"color: black; background: yellow">say join &#34;, &#34;, =
prop_invlist(&#34;ASCII_Hex_Digit=3DYes&#34;);</font>

 <font style=3D"color: black; background: yellow">prints:</font>
 <font style=3D"color: black; background: yellow">48, 58, 65, 71, 97, 103=
</font></pre>

<p><font style=3D"color: black; background: yellow">Inversion lists are a=
 compact way of specifying Unicode property-value definitions. The 0th it=
em in the list is the lowest code point that has the property-value. The =
next item (item [1]) is the lowest code point beyond that one that does N=
OT have the property-value. And the next item beyond that ([2]) is the lo=
west code point beyond that one that does have the property-value, and so=
 on. Put another way, each element in the list gives the beginning of a r=
ange that has the property-value (for even numbered elements), or doesn&#=
39;t have the property-value (for odd numbered elements). The name for th=
is data structure stems from the fact that each element in the list toggl=
es (or inverts) whether the corresponding range is or isn&#39;t on the li=
st.</font></p>

<p><font style=3D"color: black; background: yellow">In the final example =
above, the first ASCII Hex digit is code point 48, the character &#34;0&#=
34;, and all code points from it through 57 (a &#34;9&#34;) are ASCII hex=
 digits. Code points 58 through 64 aren&#39;t, but 65 (an &#34;A&#34;) th=
rough 70 (an &#34;F&#34;) are, as are 97 (&#34;a&#34;) through 102 (&#34;=
f&#34;). 103 starts a range of code points that aren&#39;t ASCII hex digi=
ts. That range extends to infinity, which on your computer can be found i=
n the variable</font> <code><font style=3D"color: black; background: yell=
ow">$Unicode::UCD::MAX_CP</font></code><font style=3D"color: black; backg=
round: yellow">. (This variable is as close to infinity as Perl can get o=
n your platform, and may be too high for some operations to work; you may=
 wish to use a smaller number for your purposes.)</font></p>

<p><font style=3D"color: black; background: yellow">Note that the inversi=
on lists returned by this function can possibly include non-Unicode code =
points, that is anything above 0x10FFFF. This is in contrast to Perl regu=
lar expression matches on those code points, in which a non-Unicode code =
point always fails to match. For example, both of these have the same res=
ult:</font></p>

<pre> <font style=3D"color: black; background: yellow">chr(0x110000) =3D~=
 \p{ASCII_Hex_Digit=3DTrue}      # Fails.</font>
 <font style=3D"color: black; background: yellow">chr(0x110000) =3D~ \p{A=
SCII_Hex_Digit=3DFalse}     # Fails!</font></pre>

<p><font style=3D"color: black; background: yellow">And both raise a warn=
ing that a Unicode property is being used on a non-Unicode code point. It=
 is arguable as to which is the correct thing to do here. This function h=
as chosen the way opposite to the Perl regular expression behavior. This =
allows you to easily flip to to the Perl regular expression way (for you =
to go in the other direction would be far harder). Simply add 0x110000 at=
 the end of the non-empty returned list if it isn&#39;t already that valu=
e; and pop that value if it is; like:</font></p>

<pre> <font style=3D"color: black; background: yellow">my @list =3D prop_=
invlist(&#34;foo&#34;);</font>
 <font style=3D"color: black; background: yellow">if (@list) {</font>
     <font style=3D"color: black; background: yellow">if ($list[-1] =3D=3D=
 0x110000) {</font>
         <font style=3D"color: black; background: yellow">pop @list;  # D=
efeat the turning on for above Unicode</font>
     <font style=3D"color: black; background: yellow">}</font>
     <font style=3D"color: black; background: yellow">else {</font>
         <font style=3D"color: black; background: yellow">push @list, 0x1=
10000; # Turn off for above Unicode</font>
     <font style=3D"color: black; background: yellow">}</font>
 <font style=3D"color: black; background: yellow">}</font></pre>

<p><font style=3D"color: black; background: yellow">It is a simple matter=
 to expand out an inversion list to a full list of all code points that h=
ave the property-value:</font></p>

<pre> <font style=3D"color: black; background: yellow">my @invlist =3D pr=
op_invlist($property_name);</font>
 <font style=3D"color: black; background: yellow">die &#34;empty&#34; unl=
ess @invlist;</font>
 <font style=3D"color: black; background: yellow">my @full_list;</font>
 <font style=3D"color: black; background: yellow">for (my $i =3D 0; $i &#=
60; @invlist; $i +=3D 2) {</font>
    <font style=3D"color: black; background: yellow">my $upper =3D ($i + =
1) &#60; @invlist</font>
                <font style=3D"color: black; background: yellow">? $invli=
st[$i+1] - 1      # In range</font>
                <font style=3D"color: black; background: yellow">: $Unico=
de::UCD::MAX_CP;  # To infinity.  You may want</font>
                                          <font style=3D"color: black; ba=
ckground: yellow"># to stop much much earlier;</font>
                                          <font style=3D"color: black; ba=
ckground: yellow"># going this high may expose</font>
                                          <font style=3D"color: black; ba=
ckground: yellow"># perl deficiencies with very</font>
                                          <font style=3D"color: black; ba=
ckground: yellow"># large numbers.</font>
    <font style=3D"color: black; background: yellow">for my $j ($invlist[=
$i] .. $upper) {</font>
        <font style=3D"color: black; background: yellow">push @full_list,=
 $j;</font>
    <font style=3D"color: black; background: yellow">}</font>
 <font style=3D"color: black; background: yellow">}</font></pre>

<p><code><font style=3D"color: black; background: yellow">prop_invlist</f=
ont></code> <font style=3D"color: black; background: yellow">does not kno=
w about any user-defined nor Perl internal-only properties, and will retu=
rn</font> <code><font style=3D"color: black; background: yellow">undef</f=
ont></code> <font style=3D"color: black; background: yellow">if called wi=
th one of those.</font></p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"prop_invmap()"
><b><font style=3D"color: black; background: yellow">prop_invmap()</font>=
</b></a></h2>

<pre> <font style=3D"color: black; background: yellow">use Unicode::UCD &=
#39;prop_invmap&#39;;</font>
 <font style=3D"color: black; background: yellow">my ($list_ref, $map_ref=
, $format, $missing)</font>
                                      <font style=3D"color: black; backgr=
ound: yellow">=3D prop_invmap(&#34;General Category&#34;);</font></pre>

<p><code><font style=3D"color: black; background: yellow">prop_invmap</fo=
nt></code> <font style=3D"color: black; background: yellow">is used to ge=
t the complete mapping definition for a property, in the form of an inver=
sion map. An inversion map consists of two parallel arrays. One is an ord=
ered list of code points that mark range beginnings, and the other gives =
the value (or mapping) that all code points in the corresponding range ha=
ve.</font></p>

<p><code><font style=3D"color: black; background: yellow">prop_invmap</fo=
nt></code> <font style=3D"color: black; background: yellow">is called wit=
h the name of the desired property. The name is loosely matched, meaning =
that differences in case, white-space, hyphens, and underscores are not m=
eaningful (except for the trailing underscore in the old-form grandfather=
ed-in property</font> <code><font style=3D"color: black; background: yell=
ow">&#34;L_&#34;</font></code><font style=3D"color: black; background: ye=
llow">, which is better written as</font> <code><font style=3D"color: bla=
ck; background: yellow">&#34;LC&#34;</font></code><font style=3D"color: b=
lack; background: yellow">, or even better,</font> <code><font style=3D"c=
olor: black; background: yellow">&#34;Gc=3DLC&#34;</font></code><font sty=
le=3D"color: black; background: yellow">).</font></p>

<p><font style=3D"color: black; background: yellow">Many Unicode properti=
es have more than one name (or alias).</font> <code><font style=3D"color:=
 black; background: yellow">prop_invmap</font></code> <font style=3D"colo=
r: black; background: yellow">understands all of these, including Perl ex=
tensions to them. Ambiguities are resolved as described above for</font> =
<a href=3D"#prop_aliases()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_aliases()&#34=
;</font></a><font style=3D"color: black; background: yellow">. The Perl i=
nternal property &#34;Perl_Decimal_Digit, described below, is also accept=
ed.</font> <code><font style=3D"color: black; background: yellow">undef</=
font></code> <font style=3D"color: black; background: yellow">is returned=
 if the property name is unknown. See</font> <a href=3D"http://search.cpa=
n.org/perldoc?perluniprops#Properties_accessible_through_Unicode%3A%3AUCD=
" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;Properties accessi=
ble through Unicode::UCD&#34; in perluniprops</font></a> <font style=3D"c=
olor: black; background: yellow">for the properties acceptable as inputs =
to this function.</font></p>

<p><font style=3D"color: black; background: yellow">It is a fatal error t=
o call this function except in list context.</font></p>

<p><font style=3D"color: black; background: yellow">In addition to the th=
e two arrays that form the inversion map,</font> <code><font style=3D"col=
or: black; background: yellow">prop_invmap</font></code> <font style=3D"c=
olor: black; background: yellow">returns two other values; one is a scala=
r that gives some details as to the format of the entries of the map arra=
y; the other is used for specialized purposes, described at the end of th=
is section.</font></p>

<p><font style=3D"color: black; background: yellow">This means that</font=
> <code><font style=3D"color: black; background: yellow">prop_invmap</fon=
t></code> <font style=3D"color: black; background: yellow">returns a 4 el=
ement list. For example,</font></p>

<pre> <font style=3D"color: black; background: yellow">my ($blocks_ranges=
_ref, $blocks_maps_ref, $format, $default)</font>
                                                 <font style=3D"color: bl=
ack; background: yellow">=3D prop_invmap(&#34;Block&#34;);</font></pre>

<p><font style=3D"color: black; background: yellow">In this call, the two=
 arrays will be populated as shown below (for Unicode 6.0):</font></p>

<pre> <font style=3D"color: black; background: yellow">Index  @blocks_ran=
ges  @blocks_maps</font>
   <font style=3D"color: black; background: yellow">0        0x0000      =
Basic Latin</font>
   <font style=3D"color: black; background: yellow">1        0x0080      =
Latin-1 Supplement</font>
   <font style=3D"color: black; background: yellow">2        0x0100      =
Latin Extended-A</font>
   <font style=3D"color: black; background: yellow">3        0x0180      =
Latin Extended-B</font>
   <font style=3D"color: black; background: yellow">4        0x0250      =
IPA Extensions</font>
   <font style=3D"color: black; background: yellow">5        0x02B0      =
Spacing Modifier Letters</font>
   <font style=3D"color: black; background: yellow">6        0x0300      =
Combining Diacritical Marks</font>
   <font style=3D"color: black; background: yellow">7        0x0370      =
Greek and Coptic</font>
   <font style=3D"color: black; background: yellow">8        0x0400      =
Cyrillic</font>
  <font style=3D"color: black; background: yellow">...</font>
 <font style=3D"color: black; background: yellow">233        0x2B820     =
No_Block</font>
 <font style=3D"color: black; background: yellow">234        0x2F800     =
CJK Compatibility Ideographs Supplement</font>
 <font style=3D"color: black; background: yellow">235        0x2FA20     =
No_Block</font>
 <font style=3D"color: black; background: yellow">236        0xE0000     =
Tags</font>
 <font style=3D"color: black; background: yellow">237        0xE0080     =
No_Block</font>
 <font style=3D"color: black; background: yellow">238        0xE0100     =
Variation Selectors Supplement</font>
 <font style=3D"color: black; background: yellow">239        0xE01F0     =
No_Block</font>
 <font style=3D"color: black; background: yellow">240        0xF0000     =
Supplementary Private Use Area-A</font>
 <font style=3D"color: black; background: yellow">241        0x100000    =
Supplementary Private Use Area-B</font>
 <font style=3D"color: black; background: yellow">242        0x110000    =
No_Block</font></pre>

<p><font style=3D"color: black; background: yellow">The first line (with =
Index [0]) means that the value for code point 0 is &#34;Basic Latin&#34;=
=2E The entry &#34;0x0080&#34; in the @blocks_ranges column in the second=
 line means that the value from the first line, &#34;Basic Latin&#34;, ex=
tends to all code points in the range from 0 up to but not including 0x00=
80, that is, through 255. In other words, the code points from 0 to 255 a=
re all in the &#34;Basic Latin&#34; block. Similarly, all code points in =
the range from 0x0080 up to (but not including) 0x0100 are in the block n=
amed &#34;Latin-1 Supplement&#34;, etc. (Notice that the return is the ol=
d-style block names; see</font> <a href=3D"#Old-style_versus_new-style_bl=
ock_names" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;Old-style versus n=
ew-style block names&#34;</font></a><font style=3D"color: black; backgrou=
nd: yellow">).</font></p>

<p><font style=3D"color: black; background: yellow">The final line (with =
Index [242]) means that the value for all code points above the legal Uni=
code maximum code point have the value &#34;No_Block&#34;, which is the t=
erm Unicode uses for a non-existing block.</font></p>

<p><font style=3D"color: black; background: yellow">The arrays completely=
 specify the mappings for all possible code points. The final element in =
an inversion map returned by this function will always be for the range t=
hat consists of all the code points that aren&#39;t legal Unicode, but th=
at are expressible on the platform. (That is, it starts with code point 0=
x110000, the first code point above the legal Unicode maximum, and extend=
s to infinity.) The value for that range will be the same that any typica=
l unassigned code point has for the specified property. (Certain unassign=
ed code points are not &#34;typical&#34;; for example the non-character c=
ode points, or those in blocks that are to be written right-to-left. The =
above-Unicode range&#39;s value is not based on these atypical code point=
s.) It could be argued that, instead of treating these as unassigned Unic=
ode code points, the value for this range should be</font> <code><font st=
yle=3D"color: black; background: yellow">undef</font></code><font style=3D=
"color: black; background: yellow">. If you wish, you can change the retu=
rned arrays accordingly.</font></p>

<p><font style=3D"color: black; background: yellow">The maps are almost a=
lways simple scalars that should be interpreted as-is. These values are t=
hose given in the Unicode-supplied data files, which may be inconsistent =
as to capitalization and as to which synonym for a property-value is give=
n. The results may be normalized by using the</font> <a href=3D"#prop_val=
ue_aliases()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_value_aliases=
()&#34;</font></a> <font style=3D"color: black; background: yellow">funct=
ion.</font></p>

<p><font style=3D"color: black; background: yellow">There are exceptions =
to the simple scalar maps. Some properties have some elements in their ma=
p list that are themselves lists of scalars; and some special strings are=
 returned that are not to be interpreted as-is. Element [2] (placed into<=
/font> <code><font style=3D"color: black; background: yellow">$format</fo=
nt></code> <font style=3D"color: black; background: yellow">in the exampl=
e above) of the returned four element list tells you if the map has any o=
f these special elements, as follows:</font></p>

<dl>
<dt><a name=3D"s"
><code><font style=3D"color: black; background: yellow">s</font></code></=
a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">means all the element=
s of the map array are simple scalars, with no special elements. Almost a=
ll properties are like this, like the</font> <code><font style=3D"color: =
black; background: yellow">block</font></code> <font style=3D"color: blac=
k; background: yellow">example above.</font></p>

<dt><a name=3D"sl"
><code><font style=3D"color: black; background: yellow">sl</font></code><=
/a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">means that some of th=
e map array elements have the form given by</font> <code><font style=3D"c=
olor: black; background: yellow">s</font></code><font style=3D"color: bla=
ck; background: yellow">, and the rest are lists of scalars. For example,=
 here is a portion of the output of calling</font> <code><font style=3D"c=
olor: black; background: yellow">prop_invmap</font></code><font style=3D"=
color: black; background: yellow">() with the &#34;Script Extensions&#34;=
 property:</font></p>

<pre> <font style=3D"color: black; background: yellow">@scripts_ranges  @=
scripts_maps</font>
      <font style=3D"color: black; background: yellow">...</font>
      <font style=3D"color: black; background: yellow">0x0953      Deva</=
font>
      <font style=3D"color: black; background: yellow">0x0964      [ Beng=
 Deva Guru Orya ]</font>
      <font style=3D"color: black; background: yellow">0x0966      Deva</=
font>
      <font style=3D"color: black; background: yellow">0x0970      Common=
</font></pre>

<p><font style=3D"color: black; background: yellow">Here, the code points=
 0x964 and 0x965 are used in the Bengali, Devanagari, Gurmukhi, and Oriya=
 scripts.</font></p>

<dt><a name=3D"r"
><code><font style=3D"color: black; background: yellow">r</font></code></=
a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">means that all the el=
ements of the map array are either rational numbers or the string</font> =
<code><font style=3D"color: black; background: yellow">&#34;NaN&#34;</fon=
t></code><font style=3D"color: black; background: yellow">, meaning &#34;=
Not a Number&#34;. A rational number is either an integer, or two integer=
s separated by a solidus (</font><code><font style=3D"color: black; backg=
round: yellow">&#34;/&#34;</font></code><font style=3D"color: black; back=
ground: yellow">). The second integer represents the denominator of the d=
ivision implied by the solidus, and is guaranteed not to be 0. If you wan=
t to convert them to scalar numbers, you can use something like this:</fo=
nt></p>

<pre> <font style=3D"color: black; background: yellow">my ($invlist_ref, =
$invmap_ref, $format) =3D prop_invmap($property);</font>
 <font style=3D"color: black; background: yellow">if ($format &#38;&#38; =
$format eq &#34;r&#34;) {</font>
     <font style=3D"color: black; background: yellow">map { $_ =3D eval $=
_ } @$invmap_ref;</font>
 <font style=3D"color: black; background: yellow">}</font></pre>

<p><font style=3D"color: black; background: yellow">Here&#39;s some entri=
es from the output of the property &#34;Nv&#34;, which has format</font> =
<code><font style=3D"color: black; background: yellow">&#34;r&#34;</font>=
</code><font style=3D"color: black; background: yellow">.</font></p>

<pre> <font style=3D"color: black; background: yellow">@numerics_ranges  =
@numerics_maps        Note</font>
        <font style=3D"color: black; background: yellow">0x00            =
 &#34;NaN&#34;</font>
        <font style=3D"color: black; background: yellow">0x30            =
 0              DIGIT 0</font>
        <font style=3D"color: black; background: yellow">0x31            =
 1</font>
        <font style=3D"color: black; background: yellow">0x32            =
 2</font>
        <font style=3D"color: black; background: yellow">...</font>
        <font style=3D"color: black; background: yellow">0x37            =
 7</font>
        <font style=3D"color: black; background: yellow">0x38            =
 8</font>
        <font style=3D"color: black; background: yellow">0x39            =
 9              DIGIT 9</font>
        <font style=3D"color: black; background: yellow">0x3A            =
 &#34;NaN&#34;</font>
        <font style=3D"color: black; background: yellow">0xB2            =
 2              SUPERSCRIPT 2</font>
        <font style=3D"color: black; background: yellow">0xB3            =
 3              SUPERSCRIPT 2</font>
        <font style=3D"color: black; background: yellow">0xB4            =
 &#34;NaN&#34;</font>
        <font style=3D"color: black; background: yellow">0xB9            =
 1              SUPERSCRIPT 1</font>
        <font style=3D"color: black; background: yellow">0xBA            =
 &#34;NaN&#34;</font>
        <font style=3D"color: black; background: yellow">0xBC            =
 1/4            VULGAR FRACTION 1/4</font>
        <font style=3D"color: black; background: yellow">0xBD            =
 1/2            VULGAR FRACTION 1/2</font>
        <font style=3D"color: black; background: yellow">0xBE            =
 3/4            VULGAR FRACTION 3/4</font>
        <font style=3D"color: black; background: yellow">0xBF            =
 &#34;NaN&#34;</font>
        <font style=3D"color: black; background: yellow">0x660           =
 0              ARABIC-INDIC DIGIT ZERO</font></pre>

<dt><a name=3D"c"
><code><font style=3D"color: black; background: yellow">c</font></code></=
a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">is like</font> <code>=
<font style=3D"color: black; background: yellow">s</font></code> <font st=
yle=3D"color: black; background: yellow">in that all the map array elemen=
ts are scalars, but some of them are the special string</font> <code><fon=
t style=3D"color: black; background: yellow">&#34;&#60;code&#160;point&#6=
2;&#34;</font></code><font style=3D"color: black; background: yellow">, m=
eaning that the map of each code point in the corresponding range in the =
inversion list is the code point itself. For example, in:</font></p>

<pre> <font style=3D"color: black; background: yellow">my ($uppers_ranges=
_ref, $uppers_maps_ref, $format)</font>
                          <font style=3D"color: black; background: yellow=
">=3D prop_invmap(&#34;Simple_Uppercase_Mapping&#34;);</font></pre>

<p><font style=3D"color: black; background: yellow">the returned arrays l=
ook like this:</font></p>

<pre> <font style=3D"color: black; background: yellow">@$uppers_ranges_re=
f    @$uppers_maps_ref   Note</font>
       <font style=3D"color: black; background: yellow">0                =
 &#34;&#60;code point&#62;&#34;</font>
      <font style=3D"color: black; background: yellow">97                =
     65          &#39;a&#39; maps to &#39;A&#39;</font>
      <font style=3D"color: black; background: yellow">98                =
     66          &#39;b&#39; =3D&#62; &#39;B&#39;</font>
      <font style=3D"color: black; background: yellow">99                =
     67          &#39;c&#39; =3D&#62; &#39;C&#39;</font>
      <font style=3D"color: black; background: yellow">...</font>
     <font style=3D"color: black; background: yellow">120                =
     88          &#39;x&#39; =3D&#62; &#39;X&#39;</font>
     <font style=3D"color: black; background: yellow">121                =
     89          &#39;y&#39; =3D&#62; &#39;Y&#39;</font>
     <font style=3D"color: black; background: yellow">122                =
     90          &#39;z&#39; =3D&#62; &#39;Z&#39;</font>
     <font style=3D"color: black; background: yellow">123                =
&#34;&#60;code point&#62;&#34;</font>
     <font style=3D"color: black; background: yellow">181                =
    924          MICRO SIGN =3D&#62; Greek Cap MU</font>
     <font style=3D"color: black; background: yellow">182                =
&#34;&#60;code point&#62;&#34;</font>
     <font style=3D"color: black; background: yellow">...</font></pre>

<p><font style=3D"color: black; background: yellow">The first line means =
that the uppercase of code point 0 is 0; the uppercase of code point 1 is=
 1; ... of code point 96 is 96. Without the</font> <code><font style=3D"c=
olor: black; background: yellow">&#34;&#60;code_point&#62;&#34;</font></c=
ode> <font style=3D"color: black; background: yellow">notation, every cod=
e point would have to have an entry. This would mean that the arrays woul=
d each have more than a million entries to list just the legal Unicode co=
de points!</font></p>

<dt><a name=3D"cl"
><code><font style=3D"color: black; background: yellow">cl</font></code><=
/a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">means that some of th=
e map array elements have the form given by</font> <code><font style=3D"c=
olor: black; background: yellow">c</font></code><font style=3D"color: bla=
ck; background: yellow">, and the rest are ordered lists of code points. =
For example, in:</font></p>

<pre> <font style=3D"color: black; background: yellow">my ($uppers_ranges=
_ref, $uppers_maps_ref, $format)</font>
                                 <font style=3D"color: black; background:=
 yellow">=3D prop_invmap(&#34;Uppercase_Mapping&#34;);</font></pre>

<p><font style=3D"color: black; background: yellow">the returned arrays l=
ook like this:</font></p>

<pre> <font style=3D"color: black; background: yellow">@$uppers_ranges_re=
f    @$uppers_maps_ref</font>
       <font style=3D"color: black; background: yellow">0                =
 &#34;&#60;code point&#62;&#34;</font>
      <font style=3D"color: black; background: yellow">97                =
     65</font>
     <font style=3D"color: black; background: yellow">...</font>
     <font style=3D"color: black; background: yellow">122                =
     90</font>
     <font style=3D"color: black; background: yellow">123                =
&#34;&#60;code point&#62;&#34;</font>
     <font style=3D"color: black; background: yellow">181                =
    924</font>
     <font style=3D"color: black; background: yellow">182                =
&#34;&#60;code point&#62;&#34;</font>
     <font style=3D"color: black; background: yellow">...</font>
    <font style=3D"color: black; background: yellow">0x0149              =
[ 0x02BC 0x004E ]</font>
    <font style=3D"color: black; background: yellow">0x014A              =
&#34;&#60;code point&#62;&#34;</font>
    <font style=3D"color: black; background: yellow">0x014B              =
   0x014A</font>
     <font style=3D"color: black; background: yellow">...</font></pre>

<p><font style=3D"color: black; background: yellow">This is the full Uppe=
rcase_Mapping property (as opposed to the Simple_Uppercase_Mapping given =
in the example for format</font> <code><font style=3D"color: black; backg=
round: yellow">&#34;c&#34;</font></code><font style=3D"color: black; back=
ground: yellow">). The only difference between the two in the ranges show=
n is that the code point at 0x0149 (LATIN SMALL LETTER N PRECEDED BY APOS=
TROPHE) maps to a string of two characters, 0x02BC (MODIFIER LETTER APOST=
ROPHE) followed by 0x004E (LATIN CAPITAL LETTER N).</font></p>

<dt><a name=3D"cle"
><code><font style=3D"color: black; background: yellow">cle</font></code>=
</a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">means that some of th=
e map array elements have the forms given by</font> <code><font style=3D"=
color: black; background: yellow">cl</font></code><font style=3D"color: b=
lack; background: yellow">, and the rest are the empty string. The proper=
ty</font> <code><font style=3D"color: black; background: yellow">NFKC_Cas=
efold</font></code> <font style=3D"color: black; background: yellow">has =
this form. An example slice is:</font></p>

<pre> <font style=3D"color: black; background: yellow">@$ranges_ref  @$ma=
ps_ref         Note</font>
    <font style=3D"color: black; background: yellow">...</font>
   <font style=3D"color: black; background: yellow">0x00AA     0x0061    =
          FEMININE ORDINAL INDICATOR =3D&#62; &#39;a&#39;</font>
   <font style=3D"color: black; background: yellow">0x00AB     &#60;code =
point&#62;</font>
   <font style=3D"color: black; background: yellow">0x00AD               =
          SOFT HYPHEN =3D&#62; &#34;&#34;</font>
   <font style=3D"color: black; background: yellow">0x00AE     &#60;code =
point&#62;</font>
   <font style=3D"color: black; background: yellow">0x00AF     [ 0x0020, =
0x0304 ]  MACRON =3D&#62; SPACE . COMBINING MACRON</font>
   <font style=3D"color: black; background: yellow">0x00B0     &#60;code =
point&#62;</font>
   <font style=3D"color: black; background: yellow">...</font></pre>

<dt><a name=3D"n"
><code><font style=3D"color: black; background: yellow">n</font></code></=
a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">means the Name proper=
ty. All the elements of the map array are simple scalars, but some of the=
m contain special strings that require more work to get the actual name.<=
/font></p>

<p><font style=3D"color: black; background: yellow">Entries such as:</fon=
t></p>

<pre> <font style=3D"color: black; background: yellow">CJK UNIFIED IDEOGR=
APH-&#60;code point&#62;</font></pre>

<p><font style=3D"color: black; background: yellow">mean that the name fo=
r the code point is &#34;CJK UNIFIED IDEOGRAPH-&#34; with the code point =
(expressed in hexadecimal) appended to it, like &#34;CJK UNIFIED IDEOGRAP=
H-3403&#34; (similarly for</font> <code><font style=3D"color: black; back=
ground: yellow">CJK COMPATIBILITY IDEOGRAPH-&#60;code point&#62;</font></=
code><font style=3D"color: black; background: yellow">).</font></p>

<p><font style=3D"color: black; background: yellow">Also, entries like</f=
ont></p>

<pre> <font style=3D"color: black; background: yellow">&#60;hangul syllab=
le&#62;</font></pre>

<p><font style=3D"color: black; background: yellow">means that the name i=
s algorithmically calculated. This is easily done by the function</font> =
<a href=3D"http://search.cpan.org/perldoc?charnames#charnames%3A%3Aviacod=
e(code)" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;charnames::viacode=
(code)&#34; in charnames</font></a><font style=3D"color: black; backgroun=
d: yellow">.</font></p>

<p><font style=3D"color: black; background: yellow">Note that for control=
 characters (</font><code><font style=3D"color: black; background: yellow=
">Gc=3Dcc</font></code><font style=3D"color: black; background: yellow">)=
, Unicode&#39;s data files have the string &#34;</font><code><font style=3D=
"color: black; background: yellow">&#60;control&#62;</font></code><font s=
tyle=3D"color: black; background: yellow">&#34;, but the real name of eac=
h of these characters is the empty string. This function returns that rea=
l name, the empty string.</font></p>

<dt><a name=3D"d"
><code><font style=3D"color: black; background: yellow">d</font></code></=
a></dt>

<dd>
<p><font style=3D"color: black; background: yellow">means the Decompositi=
on_Mapping property. This property is like</font> <code><font style=3D"co=
lor: black; background: yellow">cl</font></code> <font style=3D"color: bl=
ack; background: yellow">properties, except it has an additional entry ty=
pe:</font></p>

<pre> <font style=3D"color: black; background: yellow">&#60;hangul syllab=
le&#62;</font></pre>

<p><font style=3D"color: black; background: yellow">for those code points=
 whose decomposition is algorithmically calculated. (The</font> <code><fo=
nt style=3D"color: black; background: yellow">n</font></code> <font style=
=3D"color: black; background: yellow">format has this same entry.) These =
can be generated via the function</font> <a href=3D"http://search.cpan.or=
g/perldoc?Unicode%3A%3ANormalize" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">Unicode::Normalize::NFD=
()</font></a><font style=3D"color: black; background: yellow">.</font></p=
>

<p><font style=3D"color: black; background: yellow">Note that the mapping=
 is the one that is specified in the Unicode data files, and to get the f=
inal decomposition, it may need to be applied recursively.</font></p>
</dd>
</dl>

<p><font style=3D"color: black; background: yellow">A binary search can b=
e used to quickly find a code point in the inversion list, and hence its =
corresponding mapping.</font></p>

<p><font style=3D"color: black; background: yellow">The final element (in=
dex [3], assigned to</font> <code><font style=3D"color: black; background=
: yellow">$default</font></code> <font style=3D"color: black; background:=
 yellow">in the &#34;block&#34; example) in the four element list returne=
d by this function may be useful for applications that wish to convert th=
e returned inversion map data structure into some other, such as a hash. =
It gives the mapping that most code points map to under the property. If =
you establish the convention that any code point not explicitly listed in=
 your data structure maps to this value, you can potentially make your da=
ta structure much smaller. As you construct your data structure from the =
one returned by this function, simply ignore those ranges that map to thi=
s value, generally called the &#34;default&#34; value. For example, to co=
nvert to the data structure searchable by</font> <a href=3D"#charinrange(=
)" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;charinrange()&#34;=
</font></a><font style=3D"color: black; background: yellow">, you can fol=
low this recipe:</font></p>

<pre> <font style=3D"color: black; background: yellow">my ($list_ref, $ma=
p_ref, $format, $missing) =3D prop_invmap($property);</font>
 <font style=3D"color: black; background: yellow">my @range_list;</font>
 <font style=3D"color: black; background: yellow">for my $i (0 .. @$list_=
ref - 2) {</font>
    <font style=3D"color: black; background: yellow">next if $map_ref-&#6=
2;[$i] eq $missing;</font>
    <font style=3D"color: black; background: yellow">push @range_list, [ =
$list_ref-&#62;[$i],</font>
                        <font style=3D"color: black; background: yellow">=
$list_ref-&#62;[$i+1],</font>
                        <font style=3D"color: black; background: yellow">=
$map_ref-&#62;[$i]</font>
                      <font style=3D"color: black; background: yellow">];=
</font>
 <font style=3D"color: black; background: yellow">}</font>

 <font style=3D"color: black; background: yellow">print charinrange(\@ran=
ge_list, $code_point), &#34;\n&#34;;</font></pre>

<p><font style=3D"color: black; background: yellow">With this,</font> <co=
de><font style=3D"color: black; background: yellow">charinrange()</font><=
/code> <font style=3D"color: black; background: yellow">will return</font=
> <code><font style=3D"color: black; background: yellow">undef</font></co=
de> <font style=3D"color: black; background: yellow">if its input code po=
int maps to</font> <code><font style=3D"color: black; background: yellow"=
>$missing</font></code><font style=3D"color: black; background: yellow">.=
 You can avoid this by omitting the</font> <code><font style=3D"color: bl=
ack; background: yellow">next</font></code> <font style=3D"color: black; =
background: yellow">statement, and adding a line after the loop to handle=
 the final element of the inversion map.</font></p>

<p><font style=3D"color: black; background: yellow">One internal Perl pro=
perty is accessible by this function. &#34;Perl_Decimal_Digit&#34; return=
s an inversion map in which all the Unicode decimal digits map to their n=
umeric values, and everything else to the empty string, like so:</font></=
p>

<pre> <font style=3D"color: black; background: yellow">@digits    @values=
</font>
 <font style=3D"color: black; background: yellow">0x0000       &#34;&#34;=
</font>
 <font style=3D"color: black; background: yellow">0x0030       0</font>
 <font style=3D"color: black; background: yellow">0x0031       1</font>
 <font style=3D"color: black; background: yellow">0x0032       2</font>
 <font style=3D"color: black; background: yellow">0x0033       3</font>
 <font style=3D"color: black; background: yellow">0x0034       4</font>
 <font style=3D"color: black; background: yellow">0x0035       5</font>
 <font style=3D"color: black; background: yellow">0x0036       6</font>
 <font style=3D"color: black; background: yellow">0x0037       7</font>
 <font style=3D"color: black; background: yellow">0x0038       8</font>
 <font style=3D"color: black; background: yellow">0x0039       9</font>
 <font style=3D"color: black; background: yellow">0x003A       &#34;&#34;=
</font>
 <font style=3D"color: black; background: yellow">0x0660       0</font>
 <font style=3D"color: black; background: yellow">0x0661       1</font>
 <font style=3D"color: black; background: yellow">...</font></pre>

<p><font style=3D"color: black; background: yellow">Note that the inversi=
on maps returned for the</font> <code><font style=3D"color: black; backgr=
ound: yellow">Case_Folding</font></code> <font style=3D"color: black; bac=
kground: yellow">and</font> <code><font style=3D"color: black; background=
: yellow">Simple_Case_Folding</font></code> <font style=3D"color: black; =
background: yellow">properties do not include the Turkic-locale mappings.=
 Use</font> <a href=3D"#casefold()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;casefold()&#34;</f=
ont></a> <font style=3D"color: black; background: yellow">for these.</fon=
t></p>

<p><font style=3D"color: black; background: yellow">The</font> <code><fon=
t style=3D"color: black; background: yellow">Name_Alias</font></code> <fo=
nt style=3D"color: black; background: yellow">property is potentially und=
ergoing signficant revision by Unicode at the time of this writing. The f=
ormat of the values returned for it may change substantially in future Un=
icode versions.</font></p>

<p><code><font style=3D"color: black; background: yellow">prop_invmap</fo=
nt></code> <font style=3D"color: black; background: yellow">does not know=
 about any user-defined properties, and will return</font> <code><font st=
yle=3D"color: black; background: yellow">undef</font></code> <font style=3D=
"color: black; background: yellow">if called with one of those.</font></p=
>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"Unicode::UCD::UnicodeVersion"
>Unicode::UCD::UnicodeVersion</a></h2>

<p>This returns the version of the Unicode Character Database, in other w=
ords, the version of the Unicode standard the database implements. The ve=
rsion is a string of numbers delimited by dots (<code><font color=3D"gray=
">&#39;</font>.<font color=3D"gray">&#39;</font></code>).</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"Blocks_versus_Scripts"
><b>Blocks versus Scripts</b></a></h2>

<p>The difference between a block and a script is that scripts are closer=
 to the linguistic notion of a set of code points required to present lan=
guages, while block is more of an artifact of the Unicode code point numb=
ering and separation into blocks of (mostly) 256 code points.</p>

<p>For example the Latin <b>script</b> is spread over several <b>blocks</=
b>, such as <code>Basic Latin</code>, <code>Latin 1 Supplement</code>, <c=
ode>Latin Extended-A</code>, and <code>Latin Extended-B</code>. On the ot=
her hand, the Latin script does not contain all the characters of the <co=
de>Basic Latin</code> block (also known as ASCII): it includes only the l=
etters, and not, for example, the digits or the punctuation.</p>

<p>For blocks see <a href=3D"http://www.unicode.org/Public/UNIDATA/Blocks=
=2Etxt" class=3D"podlinkurl"
>http://www.unicode.org/Public/UNIDATA/Blocks.txt</a></p>

<p>For scripts see UTR #24: <a href=3D"http://www.unicode.org/unicode/rep=
orts/tr24/" class=3D"podlinkurl"
>http://www.unicode.org/unicode/reports/tr24/</a></p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"Matching_Scripts_and_Blocks"
><b>Matching Scripts and Blocks</b></a></h2>

<p>Scripts are matched with the regular-expression construct <code>\p{...=
}</code> (e.g. <code>\p{Tibetan}</code> matches characters of the Tibetan=
 script), while <code>\p{Blk=3D...}</code> is used for blocks (e.g. <code=
>\p{Blk=3DTibetan}</code> matches any of the 256 code points in the Tibet=
an block).</p>

<h2><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"Old-style_versus_new-style_block_names"
><font style=3D"color: black; background: yellow">Old-style versus new-st=
yle block names</font></a></h2>

<p><font style=3D"color: black; background: yellow">Unicode publishes the=
 names of blocks in two different styles, though the two are equivalent u=
nder Unicode&#39;s loose matching rules.</font></p>

<p><font style=3D"color: black; background: yellow">The original style us=
es blanks and hyphens in the block names (except for</font> <code><font s=
tyle=3D"color: black; background: yellow">No_Block</font></code><font sty=
le=3D"color: black; background: yellow">), like so:</font></p>

<pre> <font style=3D"color: black; background: yellow">Miscellaneous Math=
ematical Symbols-B</font></pre>

<p><font style=3D"color: black; background: yellow">The newer style repla=
ces these with underscores, like this:</font></p>

<pre> <font style=3D"color: black; background: yellow">Miscellaneous_Math=
ematical_Symbols_B</font></pre>

<p><font style=3D"color: black; background: yellow">This newer style is c=
onsistent with the values of other Unicode properties. To preserve backwa=
rd compatibility, all the functions in Unicode::UCD that return block nam=
es (except one) return the old-style ones. That one function,</font> <a h=
ref=3D"#prop_value_aliases()" class=3D"podlinkpod"
><font style=3D"color: black; background: yellow">&#34;prop_value_aliases=
()&#34;</font></a> <font style=3D"color: black; background: yellow">can b=
e used to convert from old-style to new-style:</font></p>

<pre> <font style=3D"color: black; background: yellow">my $new_style =3D =
prop_values_aliases(&#34;block&#34;, $old_style);</font></pre>

<p><font style=3D"color: black; background: yellow">Perl also has single-=
form extensions that refer to blocks,</font> <code><font style=3D"color: =
black; background: yellow">In_Cyrillic</font></code><font style=3D"color:=
 black; background: yellow">, meaning</font> <code><font style=3D"color: =
black; background: yellow">Block=3DCyrillic</font></code><font style=3D"c=
olor: black; background: yellow">. These have always been written in the =
new style.</font></p>

<p><font style=3D"color: black; background: yellow">To convert from new-s=
tyle to old-style, follow this recipe:</font></p>

<pre> <font style=3D"color: black; background: yellow">$old_style =3D cha=
rblock((prop_invlist(&#34;block=3D$new_style&#34;))[0]);</font></pre>

<p><font style=3D"color: black; background: yellow">(which finds the rang=
e of code points in the block using</font> <code><font style=3D"color: bl=
ack; background: yellow">prop_invlist</font></code><font style=3D"color: =
black; background: yellow">, gets the lower end of the range (0th element=
) and then looks up the old name for its block using</font> <code><font s=
tyle=3D"color: black; background: yellow">charblock</font></code><font st=
yle=3D"color: black; background: yellow">).</font></p>

<h1><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"BUGS"
>BUGS</a></h1>

<p>Does not yet support EBCDIC platforms.</p>

<h1><a class=3D'u' href=3D'#___top' title=3D'click to go to top of docume=
nt'
name=3D"AUTHOR"
>AUTHOR</a></h1>

<p>Jarkko Hietaniemi<font style=3D"color: black; background: yellow">. No=
w maintained by perl5 porters.</font></p>

<!-- end doc -->

</body></html>

--------------040705010800060903090304--