CINXE.COM

Unicode::UCD - Unicode character database - Perldoc Browser

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Unicode::UCD - Unicode character database - Perldoc Browser</title> <link rel="search" href="/opensearch.xml" type="application/opensearchdescription+xml" title="Perldoc Browser"> <link rel="canonical" href="https://perldoc.perl.org/Unicode::UCD"> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.5.0/styles/stackoverflow-light.min.css" integrity="sha512-cG1IdFxqipi3gqLmksLtuk13C+hBa57a6zpWxMeoY3Q9O6ooFxq50DayCdm0QrDgZjMUn23z/0PMZlgft7Yp5Q==" crossorigin="anonymous" /> <style> body { background: #f4f4f5; color: #020202; } .navbar-dark { background-image: -webkit-linear-gradient(top, #005f85 0, #002e49 100%); background-image: -o-linear-gradient(top, #005f85 0, #002e49 100%); background-image: linear-gradient(to bottom, #005f85 0, #002e49 100%); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff005f85', endColorstr='#ff002e49', GradientType=0); background-repeat: repeat-x; } .navbar-dark .navbar-nav .nav-link, .navbar-dark .navbar-nav .nav-link:focus { color: #fff } .navbar-dark .navbar-nav .nav-link:hover { color: #ffef68 } #wrapperlicious { margin: 0 auto; font: 0.9em 'Helvetica Neue', Helvetica, sans-serif; font-weight: normal; line-height: 1.5em; margin: 0; padding: 0; } #wrapperlicious h1 { font-size: 1.5em } #wrapperlicious h2 { font-size: 1.3em } #wrapperlicious h3 { font-size: 1.1em } #wrapperlicious h4 { font-size: 0.9em } #wrapperlicious h1, #wrapperlicious h2, #wrapperlicious h3, #wrapperlicious h4, #wrapperlicious dt { color: #020202; margin-top: 1em; margin-bottom: 1em; position: relative; font-weight: bold; } #wrapperlicious a { color: inherit; text-decoration: underline } #wrapperlicious #toc { text-decoration: none } #wrapperlicious a:hover { color: #2a2a2a } #wrapperlicious a img { border: 0 } #wrapperlicious :not(pre) > code { color: inherit; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px; font: 0.9em Consolas, Menlo, Monaco, monospace; padding: 0.3em; } #wrapperlicious dd { margin: 0; margin-left: 2em; } #wrapperlicious dt { color: #2a2a2a; font-weight: bold; margin-left: 0.9em; } #wrapperlicious p { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious li > p { margin-bottom: 0; margin-top: 0; } #wrapperlicious pre { border: 1px solid #c1c1c1; border-radius: 3px; font: 100% Consolas, Menlo, Monaco, monospace; margin-bottom: 1em; margin-top: 1em; } #wrapperlicious pre > code { display: block; background-color: #f6f6f6; font: 0.9em Consolas, Menlo, Monaco, monospace; line-height: 1.5em; text-align: left; white-space: pre; padding: 1em; } #wrapperlicious dl, #wrapperlicious ol, #wrapperlicious ul { margin-bottom: 1em; margin-top: 1em; } #wrapperlicious ul { list-style-type: square; } #wrapperlicious ul ul { margin-bottom: 0px; margin-top: 0px; } #footer { font-size: 0.8em; padding-top: 0.5em; text-align: center; } #more { display: inline; font-size: 0.8em; } #perldocdiv { background-color: #fff; border: 1px solid #c1c1c1; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; margin-left: auto; margin-right: auto; padding: 3em; padding-top: 1em; max-width: 960px; } #moduleversion { float: right } #wrapperlicious .leading-notice { font-style: italic; padding-left: 1em; margin-top: 1em; margin-bottom: 1em; } #wrapperlicious .permalink { display: none; left: -0.75em; position: absolute; padding-right: 0.25em; text-decoration: none; } #wrapperlicious h1:hover .permalink, #wrapperlicious h2:hover .permalink, #wrapperlicious h3:hover .permalink, #wrapperlicious h4:hover .permalink, #wrapperlicious dt:hover .permalink { display: block; } </style> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=G-KVNWBNT5FB"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-KVNWBNT5FB'); gtag('config', 'UA-50555-3'); </script> </head> <body> <nav class="navbar navbar-expand-md navbar-dark bg-dark justify-content-between"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <a class="navbar-brand" href="/"><img src="/images/perl_camel_30.png" width="30" height="30" class="d-inline-block align-top" alt="Perl Camel Logo"> Perldoc Browser</a> <div class="collapse navbar-collapse" id="navbarNav"> <ul class="navbar-nav mr-auto"> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-stable" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">5.8.7</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-stable"> <a class="dropdown-item" href="/Unicode::UCD">Latest</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1/Unicode::UCD">5.40.1</a> <a class="dropdown-item" href="/5.40.0/Unicode::UCD">5.40.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3/Unicode::UCD">5.38.3</a> <a class="dropdown-item" href="/5.38.2/Unicode::UCD">5.38.2</a> <a class="dropdown-item" href="/5.38.1/Unicode::UCD">5.38.1</a> <a class="dropdown-item" href="/5.38.0/Unicode::UCD">5.38.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.36.3/Unicode::UCD">5.36.3</a> <a class="dropdown-item" href="/5.36.2/Unicode::UCD">5.36.2</a> <a class="dropdown-item" href="/5.36.1/Unicode::UCD">5.36.1</a> <a class="dropdown-item" href="/5.36.0/Unicode::UCD">5.36.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.34.3/Unicode::UCD">5.34.3</a> <a class="dropdown-item" href="/5.34.2/Unicode::UCD">5.34.2</a> <a class="dropdown-item" href="/5.34.1/Unicode::UCD">5.34.1</a> <a class="dropdown-item" href="/5.34.0/Unicode::UCD">5.34.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.32.1/Unicode::UCD">5.32.1</a> <a class="dropdown-item" href="/5.32.0/Unicode::UCD">5.32.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.30.3/Unicode::UCD">5.30.3</a> <a class="dropdown-item" href="/5.30.2/Unicode::UCD">5.30.2</a> <a class="dropdown-item" href="/5.30.1/Unicode::UCD">5.30.1</a> <a class="dropdown-item" href="/5.30.0/Unicode::UCD">5.30.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.28.3/Unicode::UCD">5.28.3</a> <a class="dropdown-item" href="/5.28.2/Unicode::UCD">5.28.2</a> <a class="dropdown-item" href="/5.28.1/Unicode::UCD">5.28.1</a> <a class="dropdown-item" href="/5.28.0/Unicode::UCD">5.28.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.26.3/Unicode::UCD">5.26.3</a> <a class="dropdown-item" href="/5.26.2/Unicode::UCD">5.26.2</a> <a class="dropdown-item" href="/5.26.1/Unicode::UCD">5.26.1</a> <a class="dropdown-item" href="/5.26.0/Unicode::UCD">5.26.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.24.4/Unicode::UCD">5.24.4</a> <a class="dropdown-item" href="/5.24.3/Unicode::UCD">5.24.3</a> <a class="dropdown-item" href="/5.24.2/Unicode::UCD">5.24.2</a> <a class="dropdown-item" href="/5.24.1/Unicode::UCD">5.24.1</a> <a class="dropdown-item" href="/5.24.0/Unicode::UCD">5.24.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.22.4/Unicode::UCD">5.22.4</a> <a class="dropdown-item" href="/5.22.3/Unicode::UCD">5.22.3</a> <a class="dropdown-item" href="/5.22.2/Unicode::UCD">5.22.2</a> <a class="dropdown-item" href="/5.22.1/Unicode::UCD">5.22.1</a> <a class="dropdown-item" href="/5.22.0/Unicode::UCD">5.22.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.20.3/Unicode::UCD">5.20.3</a> <a class="dropdown-item" href="/5.20.2/Unicode::UCD">5.20.2</a> <a class="dropdown-item" href="/5.20.1/Unicode::UCD">5.20.1</a> <a class="dropdown-item" href="/5.20.0/Unicode::UCD">5.20.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.18.4/Unicode::UCD">5.18.4</a> <a class="dropdown-item" href="/5.18.3/Unicode::UCD">5.18.3</a> <a class="dropdown-item" href="/5.18.2/Unicode::UCD">5.18.2</a> <a class="dropdown-item" href="/5.18.1/Unicode::UCD">5.18.1</a> <a class="dropdown-item" href="/5.18.0/Unicode::UCD">5.18.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.16.3/Unicode::UCD">5.16.3</a> <a class="dropdown-item" href="/5.16.2/Unicode::UCD">5.16.2</a> <a class="dropdown-item" href="/5.16.1/Unicode::UCD">5.16.1</a> <a class="dropdown-item" href="/5.16.0/Unicode::UCD">5.16.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.14.4/Unicode::UCD">5.14.4</a> <a class="dropdown-item" href="/5.14.3/Unicode::UCD">5.14.3</a> <a class="dropdown-item" href="/5.14.2/Unicode::UCD">5.14.2</a> <a class="dropdown-item" href="/5.14.1/Unicode::UCD">5.14.1</a> <a class="dropdown-item" href="/5.14.0/Unicode::UCD">5.14.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.12.5/Unicode::UCD">5.12.5</a> <a class="dropdown-item" href="/5.12.4/Unicode::UCD">5.12.4</a> <a class="dropdown-item" href="/5.12.3/Unicode::UCD">5.12.3</a> <a class="dropdown-item" href="/5.12.2/Unicode::UCD">5.12.2</a> <a class="dropdown-item" href="/5.12.1/Unicode::UCD">5.12.1</a> <a class="dropdown-item" href="/5.12.0/Unicode::UCD">5.12.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.10.1/Unicode::UCD">5.10.1</a> <a class="dropdown-item" href="/5.10.0/Unicode::UCD">5.10.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.9/Unicode::UCD">5.8.9</a> <a class="dropdown-item" href="/5.8.8/Unicode::UCD">5.8.8</a> <a class="dropdown-item active" href="/5.8.7/Unicode::UCD">5.8.7</a> <a class="dropdown-item" href="/5.8.6/Unicode::UCD">5.8.6</a> <a class="dropdown-item" href="/5.8.5/Unicode::UCD">5.8.5</a> <a class="dropdown-item" href="/5.8.4/Unicode::UCD">5.8.4</a> <a class="dropdown-item" href="/5.8.3/Unicode::UCD">5.8.3</a> <a class="dropdown-item" href="/5.8.2/Unicode::UCD">5.8.2</a> <a class="dropdown-item" href="/5.8.1/Unicode::UCD">5.8.1</a> <a class="dropdown-item" href="/5.8.0/Unicode::UCD">5.8.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.6.2/Unicode::UCD">5.6.2</a> <a class="dropdown-item" href="/5.6.1/Unicode::UCD">5.6.1</a> <a class="dropdown-item" href="/5.6.0/Unicode::UCD">5.6.0</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.005_04/Unicode::UCD">5.005_04</a> <a class="dropdown-item" href="/5.005_03/Unicode::UCD">5.005_03</a> <a class="dropdown-item" href="/5.005_02/Unicode::UCD">5.005_02</a> <a class="dropdown-item" href="/5.005_01/Unicode::UCD">5.005_01</a> <a class="dropdown-item" href="/5.005/Unicode::UCD">5.005</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-dev" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dev</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-dev"> <a class="dropdown-item" href="/blead/Unicode::UCD">blead</a> <a class="dropdown-item" href="/5.41.10/Unicode::UCD">5.41.10</a> <a class="dropdown-item" href="/5.41.9/Unicode::UCD">5.41.9</a> <a class="dropdown-item" href="/5.41.8/Unicode::UCD">5.41.8</a> <a class="dropdown-item" href="/5.41.7/Unicode::UCD">5.41.7</a> <a class="dropdown-item" href="/5.41.6/Unicode::UCD">5.41.6</a> <a class="dropdown-item" href="/5.41.5/Unicode::UCD">5.41.5</a> <a class="dropdown-item" href="/5.41.4/Unicode::UCD">5.41.4</a> <a class="dropdown-item" href="/5.41.3/Unicode::UCD">5.41.3</a> <a class="dropdown-item" href="/5.41.2/Unicode::UCD">5.41.2</a> <a class="dropdown-item" href="/5.41.1/Unicode::UCD">5.41.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.40.1-RC1/Unicode::UCD">5.40.1-RC1</a> <a class="dropdown-item" href="/5.40.0-RC2/Unicode::UCD">5.40.0-RC2</a> <a class="dropdown-item" href="/5.40.0-RC1/Unicode::UCD">5.40.0-RC1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.39.10/Unicode::UCD">5.39.10</a> <a class="dropdown-item" href="/5.39.9/Unicode::UCD">5.39.9</a> <a class="dropdown-item" href="/5.39.8/Unicode::UCD">5.39.8</a> <a class="dropdown-item" href="/5.39.7/Unicode::UCD">5.39.7</a> <a class="dropdown-item" href="/5.39.6/Unicode::UCD">5.39.6</a> <a class="dropdown-item" href="/5.39.5/Unicode::UCD">5.39.5</a> <a class="dropdown-item" href="/5.39.4/Unicode::UCD">5.39.4</a> <a class="dropdown-item" href="/5.39.3/Unicode::UCD">5.39.3</a> <a class="dropdown-item" href="/5.39.2/Unicode::UCD">5.39.2</a> <a class="dropdown-item" href="/5.39.1/Unicode::UCD">5.39.1</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.38.3-RC1/Unicode::UCD">5.38.3-RC1</a> </div> </li> <li class="nav-item dropdown text-nowrap"> <a class="nav-link dropdown-toggle" href="#" id="dropdownlink-nav" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Documentation</a> <div class="dropdown-menu" aria-labelledby="dropdownlink-nav"> <a class="dropdown-item" href="/5.8.7/perl">Perl</a> <a class="dropdown-item" href="/5.8.7/perlintro">Intro</a> <a class="dropdown-item" href="/5.8.7/perl#Tutorials">Tutorials</a> <a class="dropdown-item" href="/5.8.7/perlfaq">FAQs</a> <a class="dropdown-item" href="/5.8.7/perl#Reference-Manual">Reference</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.7/perlop">Operators</a> <a class="dropdown-item" href="/5.8.7/functions">Functions</a> <a class="dropdown-item" href="/5.8.7/variables">Variables</a> <a class="dropdown-item" href="/5.8.7/modules">Modules</a> <a class="dropdown-item" href="/5.8.7/perlutil">Utilities</a> <div class="dropdown-divider"></div> <a class="dropdown-item" href="/5.8.7/perldelta">Release Notes</a> <a class="dropdown-item" href="/5.8.7/perlcommunity">Community</a> <a class="dropdown-item" href="/5.8.7/perlhist">History</a> </div> </li> </ul> <ul class="navbar-nav"> <script> function set_expand (expand) { var perldocdiv = document.getElementById('perldocdiv'); var width = window.getComputedStyle(perldocdiv).getPropertyValue('max-width'); var expanded = (width == '' || width == 'none') ? true : false; if (expand === null) { expand = !expanded; } if ((expand && !expanded) || (!expand && expanded)) { perldocdiv.style.setProperty('max-width', expand ? 'none' : '960px'); var button_classlist = document.getElementById('content-expand-button').classList; if (expand) { button_classlist.add('btn-light'); button_classlist.remove('btn-outline-light'); } else { button_classlist.add('btn-outline-light'); button_classlist.remove('btn-light'); } } return expand; } function toggle_expand () { var expand = set_expand(null); document.cookie = 'perldoc_expand=' + (expand ? 1 : 0) + '; path=/; expires=Tue, 19 Jan 2038 03:14:07 UTC'; } function read_expand () { return document.cookie.split(';').some(function (item) { return item.indexOf('perldoc_expand=1') >= 0 }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', function () { if (read_expand()) { set_expand(true); } }); } else if (read_expand()) { set_expand(true); } </script> <button id="content-expand-button" type="button" class="btn btn-outline-light d-none d-lg-inline-block mr-4" onclick="toggle_expand()">Expand</button> </ul> <form class="form-inline" method="get" action="/5.8.7/search"> <input class="form-control mr-3" type="search" name="q" placeholder="Search" aria-label="Search" value=""> </form> </div> </nav> <div id="wrapperlicious" class="container-fluid"> <div id="perldocdiv"> <div id="links"> <a href="/5.8.7/Unicode::UCD">Unicode::UCD</a> <div id="more"> (<a href="/5.8.7/Unicode::UCD.txt">source</a>, <a href="https://metacpan.org/pod/Unicode::UCD">CPAN</a>) </div> <div id="moduleversion">version 0.23</div> </div> <div class="leading-notice"> You are viewing the version of this documentation from Perl 5.8.7. <a href="/Unicode::UCD">View the latest version</a> </div> <h1><a id="toc">CONTENTS</a></h1> <ul> <li> <a class="text-decoration-none" href="#NAME">NAME</a> </li> <li> <a class="text-decoration-none" href="#SYNOPSIS">SYNOPSIS</a> </li> <li> <a class="text-decoration-none" href="#DESCRIPTION">DESCRIPTION</a> <ul> <li> <a class="text-decoration-none" href="#charinfo">charinfo</a> </li> <li> <a class="text-decoration-none" href="#charblock">charblock</a> </li> <li> <a class="text-decoration-none" href="#charscript">charscript</a> </li> <li> <a class="text-decoration-none" href="#charblocks">charblocks</a> </li> <li> <a class="text-decoration-none" href="#charscripts">charscripts</a> </li> <li> <a class="text-decoration-none" href="#Blocks-versus-Scripts">Blocks versus Scripts</a> </li> <li> <a class="text-decoration-none" href="#Matching-Scripts-and-Blocks">Matching Scripts and Blocks</a> </li> <li> <a class="text-decoration-none" href="#Code-Point-Arguments">Code Point Arguments</a> </li> <li> <a class="text-decoration-none" href="#charinrange">charinrange</a> </li> <li> <a class="text-decoration-none" href="#compexcl">compexcl</a> </li> <li> <a class="text-decoration-none" href="#casefold">casefold</a> </li> <li> <a class="text-decoration-none" href="#casespec">casespec</a> </li> <li> <a class="text-decoration-none" href="#namedseq()">namedseq()</a> </li> <li> <a class="text-decoration-none" href="#Unicode::UCD::UnicodeVersion">Unicode::UCD::UnicodeVersion</a> </li> <li> <a class="text-decoration-none" href="#Implementation-Note">Implementation Note</a> </li> </ul> </li> <li> <a class="text-decoration-none" href="#BUGS">BUGS</a> </li> <li> <a class="text-decoration-none" href="#AUTHOR">AUTHOR</a> </li> </ul> <h1 id="NAME"><a class="permalink" href="#NAME">#</a>NAME</h1> <p>Unicode::UCD - Unicode character database</p> <h1 id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">#</a>SYNOPSIS</h1> <pre><code>use Unicode::UCD &#39;charinfo&#39;; my $charinfo = charinfo($codepoint); use Unicode::UCD &#39;charblock&#39;; my $charblock = charblock($codepoint); use Unicode::UCD &#39;charscript&#39;; my $charscript = charscript($codepoint); use Unicode::UCD &#39;charblocks&#39;; my $charblocks = charblocks(); use Unicode::UCD &#39;charscripts&#39;; my %charscripts = charscripts(); use Unicode::UCD qw(charscript charinrange); my $range = charscript($script); print &quot;looks like $script\n&quot; if charinrange($range, $codepoint); use Unicode::UCD &#39;compexcl&#39;; my $compexcl = compexcl($codepoint); use Unicode::UCD &#39;namedseq&#39;; my $namedseq = namedseq($named_sequence_name); my $unicode_version = Unicode::UCD::UnicodeVersion();</code></pre> <h1 id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">#</a>DESCRIPTION</h1> <p>The Unicode::UCD module offers a simple interface to the Unicode Character Database.</p> <h2 id="charinfo"><a class="permalink" href="#charinfo">#</a>charinfo</h2> <pre><code>use Unicode::UCD &#39;charinfo&#39;; my $charinfo = charinfo(0x41);</code></pre> <p>charinfo() returns a reference to a hash that has the following fields as defined by the Unicode standard:</p> <pre><code class="plaintext">key code code point with at least four hexdigits name name of the character IN UPPER CASE category general category of the character combining classes used in the Canonical Ordering Algorithm bidi bidirectional category decomposition character decomposition mapping decimal if decimal digit this is the integer numeric value digit if digit this is the numeric value numeric if numeric is the integer or rational numeric value mirrored if mirrored in bidirectional text unicode10 Unicode 1.0 name if existed and different comment ISO 10646 comment field upper uppercase equivalent mapping lower lowercase equivalent mapping title titlecase equivalent mapping block block the character belongs to (used in \p{In...}) script script the character belongs to</code></pre> <p>If no match is found, a reference to an empty hash is returned.</p> <p>The <code>block</code> property is the same as returned by charinfo(). It is not defined in the Unicode Character Database proper (Chapter 4 of the Unicode 3.0 Standard, aka TUS3) but instead in an auxiliary database (Chapter 14 of TUS3). Similarly for the <code>script</code> property.</p> <p>Note that you cannot do (de)composition and casing based solely on the above <code>decomposition</code> and <code>lower</code>, <code>upper</code>, <code>title</code>, properties, you will need also the compexcl(), casefold(), and casespec() functions.</p> <h2 id="charblock"><a class="permalink" href="#charblock">#</a>charblock</h2> <pre><code>use Unicode::UCD &#39;charblock&#39;; my $charblock = charblock(0x41); my $charblock = charblock(1234); my $charblock = charblock(&quot;0x263a&quot;); my $charblock = charblock(&quot;U+263a&quot;); my $range = charblock(&#39;Armenian&#39;);</code></pre> <p>With a <b>code point argument</b> charblock() returns the <i>block</i> the character belongs to, e.g. <code>Basic Latin</code>. Note that not all the character positions within all blocks are defined.</p> <p>See also <a href="#Blocks-versus-Scripts">&quot;Blocks versus Scripts&quot;</a>.</p> <p>If supplied with an argument that can&#39;t be a code point, charblock() tries to do the opposite and interpret the argument as a character block. The return value is a <i>range</i>: an anonymous list of lists that contain <i>start-of-range</i>, <i>end-of-range</i> code point pairs. You can test whether a code point is in a range using the <a href="#charinrange">&quot;charinrange&quot;</a> function. If the argument is not a known charater block, <code>undef</code> is returned.</p> <h2 id="charscript"><a class="permalink" href="#charscript">#</a>charscript</h2> <pre><code>use Unicode::UCD &#39;charscript&#39;; my $charscript = charscript(0x41); my $charscript = charscript(1234); my $charscript = charscript(&quot;U+263a&quot;); my $range = charscript(&#39;Thai&#39;);</code></pre> <p>With a <b>code point argument</b> charscript() returns the <i>script</i> the character belongs to, e.g. <code>Latin</code>, <code>Greek</code>, <code>Han</code>.</p> <p>See also <a href="#Blocks-versus-Scripts">&quot;Blocks versus Scripts&quot;</a>.</p> <p>If supplied with an argument that can&#39;t be a code point, charscript() tries to do the opposite and interpret the argument as a character script. The return value is a <i>range</i>: an anonymous list of lists that contain <i>start-of-range</i>, <i>end-of-range</i> code point pairs. You can test whether a code point is in a range using the <a href="#charinrange">&quot;charinrange&quot;</a> function. If the argument is not a known charater script, <code>undef</code> is returned.</p> <h2 id="charblocks"><a class="permalink" href="#charblocks">#</a>charblocks</h2> <pre><code>use Unicode::UCD &#39;charblocks&#39;; my $charblocks = charblocks();</code></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="#charblock">&quot;charblock&quot;</a>) as the values.</p> <p>See also <a href="#Blocks-versus-Scripts">&quot;Blocks versus Scripts&quot;</a>.</p> <h2 id="charscripts"><a class="permalink" href="#charscripts">#</a>charscripts</h2> <pre><code>use Unicode::UCD &#39;charscripts&#39;; my %charscripts = charscripts();</code></pre> <p>charscripts() returns a hash with the known script names as the keys, and the code point ranges (see <a href="#charscript">&quot;charscript&quot;</a>) as the values.</p> <p>See also <a href="#Blocks-versus-Scripts">&quot;Blocks versus Scripts&quot;</a>.</p> <h2 id="Blocks-versus-Scripts"><a class="permalink" href="#Blocks-versus-Scripts">#</a><a id="Blocks"></a>Blocks versus Scripts</h2> <p>The difference between a block and a script is that scripts are closer to the linguistic notion of a set of characters required to present languages, while block is more of an artifact of the Unicode character numbering and separation into blocks of (mostly) 256 characters.</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>, <code>Latin Extended-A</code>, and <code>Latin Extended-B</code>. On the other hand, the Latin script does not contain all the characters of the <code>Basic Latin</code> block (also known as the ASCII): it includes only the letters, and not, for example, the digits or the punctuation.</p> <p>For blocks see http://www.unicode.org/Public/UNIDATA/Blocks.txt</p> <p>For scripts see UTR #24: http://www.unicode.org/unicode/reports/tr24/</p> <h2 id="Matching-Scripts-and-Blocks"><a class="permalink" href="#Matching-Scripts-and-Blocks">#</a><a id="Matching"></a>Matching Scripts and Blocks</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{In...}</code> is used for blocks (e.g. <code>\p{InTibetan}</code> matches any of the 256 code points in the Tibetan block).</p> <h2 id="Code-Point-Arguments"><a class="permalink" href="#Code-Point-Arguments">#</a><a id="Code"></a>Code Point Arguments</h2> <p>A <i>code point argument</i> is either a decimal or a hexadecimal scalar designating a Unicode character, or <code>U+</code> followed by hexadecimals designating a Unicode character. 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> or <code>U+</code>, because a string like e.g. <code>123</code> will be interpreted as a decimal code point. Also note that Unicode is <b>not</b> limited to 16 bits (the number of Unicode characters is open-ended, in theory unlimited): you may have more than 4 hexdigits.</p> <h2 id="charinrange"><a class="permalink" href="#charinrange">#</a>charinrange</h2> <p>In addition to using the <code>\p{In...}</code> and <code>\P{In...}</code> constructs, you can also test whether a code point is in the <i>range</i> as returned by <a href="#charblock">&quot;charblock&quot;</a> and <a href="#charscript">&quot;charscript&quot;</a> or as the values of the hash returned by <a href="#charblocks">&quot;charblocks&quot;</a> and <a href="#charscripts">&quot;charscripts&quot;</a> by using charinrange():</p> <pre><code>use Unicode::UCD qw(charscript charinrange); $range = charscript(&#39;Hiragana&#39;); print &quot;looks like hiragana\n&quot; if charinrange($range, $codepoint);</code></pre> <h2 id="compexcl"><a class="permalink" href="#compexcl">#</a>compexcl</h2> <pre><code>use Unicode::UCD &#39;compexcl&#39;; my $compexcl = compexcl(&quot;09dc&quot;);</code></pre> <p>The compexcl() returns the composition exclusion (that is, if the character should not be produced during a precomposition) of the character specified by a <b>code point argument</b>.</p> <p>If there is a composition exclusion for the character, true is returned. Otherwise, false is returned.</p> <h2 id="casefold"><a class="permalink" href="#casefold">#</a>casefold</h2> <pre><code>use Unicode::UCD &#39;casefold&#39;; my $casefold = casefold(&quot;00DF&quot;);</code></pre> <p>The casefold() returns the locale-independent case folding of the character specified by a <b>code point argument</b>.</p> <p>If there is a case folding for that character, a reference to a hash with the following fields is returned:</p> <pre><code class="plaintext">key code code point with at least four hexdigits status &quot;C&quot;, &quot;F&quot;, &quot;S&quot;, or &quot;I&quot; mapping one or more codes separated by spaces</code></pre> <p>The meaning of the <i>status</i> is as follows:</p> <pre><code class="plaintext">C common case folding, common mappings shared by both simple and full mappings F full case folding, mappings that cause strings to grow in length. Multiple characters are separated by spaces S simple case folding, mappings to single characters where different from F I special case for dotted uppercase I and dotless lowercase i - If this mapping is included, the result is case-insensitive, but dotless and dotted I&#39;s are not distinguished - If this mapping is excluded, the result is not fully case-insensitive, but dotless and dotted I&#39;s are distinguished</code></pre> <p>If there is no case folding for that character, <code>undef</code> is returned.</p> <p>For more information about case mappings see http://www.unicode.org/unicode/reports/tr21/</p> <h2 id="casespec"><a class="permalink" href="#casespec">#</a>casespec</h2> <pre><code>use Unicode::UCD &#39;casespec&#39;; my $casespec = casespec(&quot;FB00&quot;);</code></pre> <p>The casespec() returns the potentially locale-dependent case mapping of the character specified by a <b>code point argument</b>. The mapping may change the length of the string (which the basic Unicode case mappings as returned by charinfo() never do).</p> <p>If there is a case folding for that character, a reference to a hash with the following fields is returned:</p> <pre><code class="plaintext">key code code point with at least four hexdigits lower lowercase title titlecase upper uppercase condition condition list (may be undef)</code></pre> <p>The <code>condition</code> is optional. Where present, it consists of one or more <i>locales</i> or <i>contexts</i>, separated by spaces (other than as used to separate elements, spaces are to be ignored). A condition list overrides the normal behavior if all of the listed conditions are true. Case distinctions in the condition list are not significant. Conditions preceded by &quot;NON_&quot; represent the negation of the condition.</p> <p>Note that when there are multiple case folding definitions for a single code point because of different locales, the value returned by casespec() is a hash reference which has the locales as the keys and hash references as described above as the values.</p> <p>A <i>locale</i> is defined as a 2-letter ISO 3166 country code, possibly followed by a &quot;_&quot; and a 2-letter ISO language code (possibly followed by a &quot;_&quot; and a variant code). You can find the lists of those codes, see <a href="/5.8.7/Locale::Country">Locale::Country</a> and <a href="/5.8.7/Locale::Language">Locale::Language</a>.</p> <p>A <i>context</i> is one of the following choices:</p> <pre><code class="plaintext">FINAL The letter is not followed by a letter of general category L (e.g. Ll, Lt, Lu, Lm, or Lo) MODERN The mapping is only used for modern text AFTER_i The last base character was &quot;i&quot; (U+0069)</code></pre> <p>For more information about case mappings see http://www.unicode.org/unicode/reports/tr21/</p> <h2 id="namedseq()"><a class="permalink" href="#namedseq()">#</a><a id="namedseq"></a>namedseq()</h2> <pre><code>use Unicode::UCD &#39;namedseq&#39;; my $namedseq = namedseq(&quot;KATAKANA LETTER AINU P&quot;); my @namedseq = namedseq(&quot;KATAKANA LETTER AINU P&quot;); my %namedseq = namedseq();</code></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</code> if no named sequence by that name exists. If used with a single argument in a list context, returns list of the code points. 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 strings as the values. Otherwise, returns <code>undef</code> or empty list depending on the context.</p> <p>(New from Unicode 4.1.0)</p> <h2 id="Unicode::UCD::UnicodeVersion"><a class="permalink" href="#Unicode::UCD::UnicodeVersion">#</a><a id="Unicode"></a>Unicode::UCD::UnicodeVersion</h2> <p>Unicode::UCD::UnicodeVersion() returns the version of the Unicode Character Database, in other words, the version of the Unicode standard the database implements. The version is a string of numbers delimited by dots (<code>&#39;.&#39;</code>).</p> <h2 id="Implementation-Note"><a class="permalink" href="#Implementation-Note">#</a><a id="Implementation"></a>Implementation Note</h2> <p>The first use of charinfo() opens a read-only filehandle to the Unicode Character Database (the database is included in the Perl distribution). The filehandle is then kept open for further queries. In other words, if you are wondering where one of your filehandles went, that&#39;s where.</p> <h1 id="BUGS"><a class="permalink" href="#BUGS">#</a>BUGS</h1> <p>Does not yet support EBCDIC platforms.</p> <h1 id="AUTHOR"><a class="permalink" href="#AUTHOR">#</a>AUTHOR</h1> <p>Jarkko Hietaniemi</p> </div> <div id="footer"> <p>Perldoc Browser is maintained by Dan Book (<a href="https://metacpan.org/author/DBOOK">DBOOK</a>). Please contact him via the <a href="https://github.com/Grinnz/perldoc-browser/issues">GitHub issue tracker</a> or <a href="mailto:dbook@cpan.org">email</a> regarding any issues with the site itself, search, or rendering of documentation.</p> <p>The Perl documentation is maintained by the Perl 5 Porters in the development of Perl. Please contact them via the <a href="https://github.com/Perl/perl5/issues">Perl issue tracker</a>, the <a href="https://lists.perl.org/list/perl5-porters.html">mailing list</a>, or <a href="https://kiwiirc.com/client/irc.perl.org/p5p">IRC</a> to report any issues with the contents or format of the documentation.</p> </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.1/umd/popper.min.js" integrity="sha512-ubuT8Z88WxezgSqf3RLuNi5lmjstiJcyezx34yIU2gAHonIi27Na7atqzUZCOoY4CExaoFumzOsFQ2Ch+I/HCw==" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js" integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV" crossorigin="anonymous"></script> <script src="/js/highlight.pack.js"></script> <script>hljs.highlightAll();</script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10