| 1 | <!DOCTYPE html> <html lang="EN"> <head> <meta charset="utf-8"> <title>Uax 15</title> <style>html body{margin:0 auto 0 auto;padding:20px;max-width:1024px;font-family:sans-serif;font-size:14pt;overflow-y:scroll;}html body a{text-decoration:none;}html body a[href]{color:#0055AA;}html body a[href]:hover{color:#0088EE;}html body pre{background:#FAFAFA;border:1px solid #DDDDDD;padding:0.75em;overflow-x:auto;}html body pre >code a[href]{color:#223388;}article.project h1,article.project h2,article.project h3,article.project h4,article.project h5,article.project h6{margin:0.2em 0 0.1em 0;text-indent:1em;}article.project >header{text-align:center;}article.project >header img.logo{display:block;margin:auto;max-height:170px;}article.project >header h1{display:inline-block;text-indent:0;font-size:2.5em;}article.project >header .version{vertical-align:bottom;}article.project >header .languages{margin-top:-0.5em;text-transform:capitalize;}article.project >header .description{margin:0;}article.project >header .pages{margin-top:0.5em;font-size:1.2em;text-transform:capitalize;}article.project >header .pages a{display:inline-block;padding:0 0.2em;}article.project >section{margin:1em 0 1em 0;}article.project #index >ul{list-style:none;margin:0;padding:0;}article.project .row label{display:inline-block;min-width:6em;}article.project #system .row{display:flex;}article.project #system #dependencies{display:inline;margin:0;padding:0;}article.project #system #dependencies li{display:inline;padding:0 0.2em;}article.definition{margin:1em 0 0 0;}article.definition >header h1,article.definition >header h2,article.definition >header h3,article.definition >header h4,article.definition >header h5,article.definition >header h6{text-indent:0;display:inline-block;}article.definition >header ul{display:inline-block;list-style:none;margin:0;padding:0;}article.definition >header ul li{display:inline-block;padding:0 0.2em 0 0;}article.definition >header .visibility{display:none;}article.definition >header .visibility,article.definition >header .type{text-transform:lowercase;}article.definition >header .source-link{visibility:hidden;float:right;}article.definition >header .source-link:after{visibility:visible;content:"[SRC]";}article.definition .docstring{margin:0 0 0 1em;}article.definition .docstring pre{font-size:0.8em;white-space:pre-wrap;}.definition.package >header ul.nicknames{display:inline-block;list-style:none;margin:0;padding:0 0 0 1em;}.definition.package >header ul.nicknames li{display:inline;}.definition.package >header ul.nicknames:before{content:"(";}.definition.package >header ul.nicknames:after{content:")";}.definition.package ul.definitions{margin:0;list-style:none;padding:0 0 0 0.5em;}.definition.callable >header .name:before,.definition.type >header .name:before{content:"(";font-weight:normal;}.definition.callable >header .arguments:after,.definition.type >header .arguments:after{content:")";}.definition.callable >header .arguments .arguments:before,.definition.type >header .arguments .arguments:before{content:"(";}.definition.callable >header .arguments .argument,.definition.type >header .arguments .argument{padding:0;}.definition.callable >header .arguments .argument.lambda-list-keyword,.definition.type >header .arguments .argument.lambda-list-keyword{color:#991155;}.definition li>mark{background:none;border-left:0.3em solid #0088EE;padding-left:0.3em;display:block;}</style> </head> <body> <article class="project"> <header> <h1>uax 15</h1> <span class="version"></span> <nav class="languages"> <a href="index.html">English</a> </nav> <p class="description">Common lisp implementation of Unicode normalization functions :nfc, :nfd, :nfkc and :nfkd (Uax-15)</p> <nav class="pages"> <a href="index.html">uax 15</a> <a href="tests/uax-15/index.html">uax 15/tests</a> </nav> </header> <section id="documentation"><h1>uax-15</h1> <p>This package provides a common lisp unicode normalization function using nfc, nfd, nfkc and nfkd as per Unicode Standard Annex #15 found at <a href="http://www.unicode.org/reports/tr15/tr15-22.html">http://www.unicode.org/reports/tr15/tr15-22.html</a>.</p> <p>This is a fork of a subset of work done by Takeru Ohta in 2010. Future work is intended to provide support for https://tools.ietf.org/html/rfc8264 and https://tools.ietf.org/html/rfc7564.</p> <h1>Implementation Notes</h1> <p>This has been successfully tested on sbcl, ccl, ecl, abcl, allegro and cmucl against the unicode test file found at <a href="http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt">http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt</a></p> <p>Clisp still has some issues. It has not been tested against lispworks or other common lisp implementations.</p> <h1>Usage</h1> <p>It has one major exported function:</p> <ul> <li>(normalize (str unicode-normalization-method))</li> </ul> <p>The currently supported normalization methods are :nfc :nfkc :nfd :nfkd</p> <p>Normalization example with reference to relevant xkcd <a href="https://www.xkcd.com/936/">https://www.xkcd.com/936/</a></p> <pre><code> (<a href="#FUNCTION%20UAX-15%3ANORMALIZE" class="xref">normalize</a> "正しい馬バッテリーステープル" :nfkc) |
| 2 | "正しい馬バッテリーステープル" |
| 3 | |
| 4 | (<a href="#FUNCTION%20UAX-15%3ANORMALIZE" class="xref">normalize</a> "الحصان الصحيح البطارية التيلة" :nfkc) |
| 5 | "الحصان الصحيح البطارية التيلة" |
| 6 | |
| 7 | (<a href="#FUNCTION%20UAX-15%3ANORMALIZE" class="xref">normalize</a> "اstáplacha ceart ceallraí capall" :nfkc) |
| 8 | "اstáplacha ceart ceallraí capall"</code></pre> <h1>To Do list</h1> <ul> <li>Implement and validate against https://tools.ietf.org/html/rfc8264 and https://tools.ietf.org/html/rfc7564</li> <li>Optimization?</li> </ul> <p>More relevant xkcd <a href="https://xkcd.com/1726/">https://xkcd.com/1726/</a>, <a href="https://xkcd.com/1953/">https://xkcd.com/1953/</a>, <a href="https://www.xkcd.com/1209/">https://www.xkcd.com/1209/</a>, <a href="https://xkcd.com/1137/">https://xkcd.com/1137/</a></p> <h1>Data Files</h1> <ul> <li>UnicodeData.txt was downloaded from <a href="http://www.unicode.org/Public/UNIDATA/UnicodeData.txt">http://www.unicode.org/Public/UNIDATA/UnicodeData.txt</a></li> <li>The file CompositionExclusions.txt was downloaded from <a href="http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt">http://www.unicode.org/Public/UNIDATA/CompositionExclusions.txt</a></li> <li>The file DerivedNormalizationProps.txt was downloaded from <a href="http://www.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt">http://www.unicode.org/Public/UNIDATA/DerivedNormalizationProps.txt</a></li> <li>The test file NormalizationTest.txt was downloaded from <a href="http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt">http://www.unicode.org/Public/UNIDATA/NormalizationTest.txt</a></li> </ul> <h1>Other References</h1> <ul> <li><a href="https://tools.ietf.org/html/rfc5802">https://tools.ietf.org/html/rfc5802</a></li> <li><a href="http://www.unicode.org/reports/tr15/#References">http://www.unicode.org/reports/tr15/#References</a></li> <li><a href="https://www.unicode.org/reports/tr41/tr41-24.html">https://www.unicode.org/reports/tr41/tr41-24.html</a></li> <li><a href="https://www.unicode.org/charts/normalization/">https://www.unicode.org/charts/normalization/</a></li> <li><a href="https://towardsdatascience.com/difference-between-nfd-nfc-nfkd-and-nfkc-explained-with-python-code-e2631f96ae6c">https://towardsdatascience.com/difference-between-nfd-nfc-nfkd-and-nfkc-explained-with-python-code-e2631f96ae6c</a></li> <li><a href="https://en.wikipedia.org/wiki/Unicode_equivalence">https://en.wikipedia.org/wiki/Unicode_equivalence</a></li> <li><a href="http://www.unicode.org/faq/normalization.html">http://www.unicode.org/faq/normalization.html</a></li> <li><a href="https://github.com/edicl/cl-unicode/blob/master/specials.lisp">https://github.com/edicl/cl-unicode/blob/master/specials.lisp</a></li> <li><a href="https://perldoc.perl.org/Unicode/Normalize.html">https://perldoc.perl.org/Unicode/Normalize.html</a></li> <li><a href="https://www.mkssoftware.com/docs/perl/lib/Unicode/Normalize.asp">https://www.mkssoftware.com/docs/perl/lib/Unicode/Normalize.asp</a></li> <li><a href="https://github.com/Wisdom/Awesome-Unicode">https://github.com/Wisdom/Awesome-Unicode</a></li> </ul> </section> <section id="system"> <h2>System Information</h2> <div class="row"> <label for="dependencies">Dependencies:</label> <ul id="dependencies"><li><a class="external">split-sequence</a></li><li><a class="external">cl-ppcre</a></li><li><a class="external">uiop</a></li></ul> </div> <div class="row"> <label for="author">Author:</label> <a id="author" href="mailto:sabra.crolleton@gmail.com">Takeru Ohta, Sabra Crolleton</a> </div> <div class="row"> <label for="license">License:</label> <a id="license" href="file:///home/wol/quicklisp/local-projects/uax-15/LICENSE">MIT</a> </div> </section> <section id="index"> <h2>Definition Index</h2> <ul> <li> <article class="definition package" id="PACKAGE UAX-15"> <header> <h3> <a href="#PACKAGE%20UAX-15">UAX-15</a> </h3> <ul class="nicknames"></ul> </header> <div class="docstring"><i>No documentation provided.</i></div> <ul class="definitions"> <li> <article class="definition function callable" id="FUNCTION UAX-15:GET-CANONICAL-COMBINING-CLASS-MAP"> <header> <span class="visibility">EXTERNAL</span> <span class="type">FUNCTION</span> <h4 class="name"> <a href="#FUNCTION%20UAX-15%3AGET-CANONICAL-COMBINING-CLASS-MAP">GET-CANONICAL-COMBINING-CLASS-MAP</a> </h4> <ul class="qualifiers"></ul> <ul class="arguments"></ul> <a class="source-link" href="file:///home/wol/quicklisp/local-projects/uax-15/src/uax-15.lisp#55:0">Source</a> </header> <div class="docstring"><i>No documentation provided.</i></div> </article> </li> <li> <article class="definition function callable" id="FUNCTION UAX-15:GET-ILLEGAL-CHAR-LIST"> <header> <span class="visibility">EXTERNAL</span> <span class="type">FUNCTION</span> <h4 class="name"> <a href="#FUNCTION%20UAX-15%3AGET-ILLEGAL-CHAR-LIST">GET-ILLEGAL-CHAR-LIST</a> </h4> <ul class="qualifiers"></ul> <ul class="arguments"> <li class="argument">NORMALIZATION-FORM</li> </ul> <a class="source-link" href="file:///home/wol/quicklisp/local-projects/uax-15/src/uax-15.lisp#58:0">Source</a> </header> <div class="docstring"><pre>Takes a normalization form, e.g. :nfkc and returns a list of lists of form (#NO-BREAK_SPACE NIL) where the first item is the character name and the second item has the value N or M or nil indicating whether the character may require renormalization.</pre></div> </article> </li> <li> <article class="definition function callable" id="FUNCTION UAX-15:GET-MAPPING"> <header> <span class="visibility">EXTERNAL</span> <span class="type">FUNCTION</span> <h4 class="name"> <a href="#FUNCTION%20UAX-15%3AGET-MAPPING">GET-MAPPING</a> </h4> <ul class="qualifiers"></ul> <ul class="arguments"> <li class="argument">NORMALIZATION-FORM</li> <ul class="arguments"></ul> <ul class="arguments"></ul> </ul> <a class="source-link" href="file:///home/wol/quicklisp/local-projects/uax-15/src/uax-15.lisp#23:0">Source</a> </header> <div class="docstring"><pre>Note no mapping for :nfkc</pre></div> </article> </li> <li> <article class="definition function callable" id="FUNCTION UAX-15:NORMALIZE"> <header> <span class="visibility">EXTERNAL</span> <span class="type">FUNCTION</span> <h4 class="name"> <a href="#FUNCTION%20UAX-15%3ANORMALIZE">NORMALIZE</a> </h4> <ul class="qualifiers"></ul> <ul class="arguments"> <li class="argument">STR</li> <li class="argument">NORMALIZATION-FORM</li> <li class="argument lambda-list-keyword">&KEY</li> <li class="argument">RFC</li> </ul> <a class="source-link" href="file:///home/wol/quicklisp/local-projects/uax-15/src/uax-15.lisp#5:0">Source</a> </header> <div class="docstring"><pre>Base external function which calls the appropriate normalization for the normalization form. The default normaliation form is :nfkc, but :nfd, :nfkd and :nfc are also available.</pre></div> </article> </li> </ul> </article> </li> </ul> </section> </article> <script>window.addEventListener("DOMContentLoaded", function(){ |
| 9 | var unmarkElement = function(el){ |
| 10 | if(el.tagName === "mark" || el.tagName === "MARK"){ |
| 11 | [].forEach.call(el.childNodes, function(child){ |
| 12 | el.parentNode.insertBefore(child, el); |
| 13 | }); |
| 14 | el.parentNode.removeChild(el); |
| 15 | }else if(el.parentNode.tagName === "mark"){ |
| 16 | return unmarkElement(el.parentNode); |
| 17 | } |
| 18 | return null; |
| 19 | } |
| 20 | |
| 21 | var unmarkAll = function(root){ |
| 22 | root = root || document; |
| 23 | [].forEach.call(root.querySelectorAll("mark"), unmarkElement); |
| 24 | } |
| 25 | |
| 26 | var markElement = function(el){ |
| 27 | if(el.parentNode.tagName === "mark" || el.parentNode.tagName === "MARK"){ |
| 28 | return el.parentNode; |
| 29 | } else { |
| 30 | unmarkAll(); |
| 31 | var marked = document.createElement("mark"); |
| 32 | el.parentNode.insertBefore(marked, el); |
| 33 | marked.appendChild(el); |
| 34 | return marked; |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | var markFragmented = function(){ |
| 39 | if(window.location.hash){ |
| 40 | var el = document.getElementById(decodeURIComponent(window.location.hash.substr(1))); |
| 41 | if(el) markElement(el); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | var registerXrefLink = function(link){ |
| 46 | var el = document.getElementById(decodeURIComponent(link.getAttribute("href").substr(1))); |
| 47 | if(el){ |
| 48 | link.addEventListener("click", function(){ |
| 49 | markElement(el); |
| 50 | }); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | var registerXrefLinks = function(root){ |
| 55 | root = root || document; |
| 56 | [].forEach.call(root.querySelectorAll("a.xref"), registerXrefLink); |
| 57 | } |
| 58 | |
| 59 | markFragmented(); |
| 60 | registerXrefLinks(); |
| 61 | }); </script> </body> </html> |