<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h4 class="title">
      <a name="ldml-rules">
      </a>
      12.14.4.2 LDML Syntax Supported in MySQL
     </h4>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045215060544">
  </a>
  <p>
   This section describes the LDML syntax that MySQL recognizes.
          This is a subset of the syntax described in the LDML
          specification available at
   <a class="ulink" href="http://www.unicode.org/reports/tr35/" target="_blank">
    http://www.unicode.org/reports/tr35/
   </a>
   , which
          should be consulted for further information. MySQL recognizes
          a large enough subset of the syntax that, in many cases, it is
          possible to download a collation definition from the Unicode
          Common Locale Data Repository and paste the relevant part
          (that is, the part between the
   <code class="literal">
    &lt;rules&gt;
   </code>
   and
   <code class="literal">
    &lt;/rules&gt;
   </code>
   tags) into the MySQL
   <code class="filename">
    Index.xml
   </code>
   file. The rules described here
          are all supported except that character sorting occurs only at
          the primary level. Rules that specify differences at secondary
          or higher sort levels are recognized (and thus can be included
          in collation definitions) but are treated as equality at the
          primary level.
  </p>
  <p>
   The MySQL server generates diagnostics when it finds problems
          while parsing the
   <code class="filename">
    Index.xml
   </code>
   file. See
   <a class="xref" href="collation-diagnostics.html" title="12.14.4.3 Diagnostics During Index.xml Parsing">
    Section 12.14.4.3, “Diagnostics During Index.xml Parsing”
   </a>
   .
  </p>
  <p>
   <span class="bold">
    <strong>
     Character Representation
    </strong>
   </span>
  </p>
  <p>
   Characters named in LDML rules can be written literally or in
   <code class="literal">
    \u
    <em class="replaceable">
     <code>
      nnnn
     </code>
    </em>
   </code>
   format,
          where
   <em class="replaceable">
    <code>
     nnnn
    </code>
   </em>
   is the hexadecimal
          Unicode code point value. For example,
   <code class="literal">
    A
   </code>
   and
   <code class="literal">
    á
   </code>
   can be written literally or as
   <code class="literal">
    \u0041
   </code>
   and
   <code class="literal">
    \u00E1
   </code>
   .
          Within hexadecimal values, the digits
   <code class="literal">
    A
   </code>
   through
   <code class="literal">
    F
   </code>
   are not case-sensitive;
   <code class="literal">
    \u00E1
   </code>
   and
   <code class="literal">
    \u00e1
   </code>
   are
          equivalent. For UCA 4.0.0 collations, hexadecimal notation can
          be used only for characters in the Basic Multilingual Plane,
          not for characters outside the BMP range of
   <code class="literal">
    0000
   </code>
   to
   <code class="literal">
    FFFF
   </code>
   . For UCA
          5.2.0 collations, hexadecimal notation can be used for any
          character.
  </p>
  <p>
   The
   <code class="filename">
    Index.xml
   </code>
   file itself should be
          written using UTF-8 encoding.
  </p>
  <p>
   <span class="bold">
    <strong>
     Syntax Rules
    </strong>
   </span>
  </p>
  <p>
   LDML has reset rules and shift rules to specify character
          ordering. Orderings are given as a set of rules that begin
          with a reset rule that establishes an anchor point, followed
          by shift rules that indicate how characters sort relative to
          the anchor point.
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      A
      <code class="literal">
       &lt;reset&gt;
      </code>
      rule does not specify
              any ordering in and of itself. Instead, it
      <span class="quote">
       “
       <span class="quote">
        resets
       </span>
       ”
      </span>
      the ordering for subsequent shift
              rules to cause them to be taken in relation to a given
              character. Either of the following rules resets subsequent
              shift rules to be taken in relation to the letter
      <code class="literal">
       'A'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa16353630"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>A<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>\u0041<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      The
      <code class="literal">
       &lt;p&gt;
      </code>
      ,
      <code class="literal">
       &lt;s&gt;
      </code>
      , and
      <code class="literal">
       &lt;t&gt;
      </code>
      shift rules define primary,
              secondary, and tertiary differences of a character from
              another character:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         Use primary differences to distinguish separate
                  letters.
        </p>
       </li>
       <li class="listitem">
        <p>
         Use secondary differences to distinguish accent
                  variations.
        </p>
       </li>
       <li class="listitem">
        <p>
         Use tertiary differences to distinguish lettercase
                  variations.
        </p>
       </li>
      </ul>
     </div>
     <p>
      Either of these rules specifies a primary shift rule for
              the
      <code class="literal">
       'G'
      </code>
      character:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa12427996"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>G<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span>

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>\u0047<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      The
      <code class="literal">
       &lt;i&gt;
      </code>
      shift rule indicates that
              one character sorts identically to another. The following
              rules cause
      <code class="literal">
       'b'
      </code>
      to sort the same as
      <code class="literal">
       'a'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa50691149"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>a<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>i</span><span class="token punctuation">&gt;</span></span>b<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>i</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Abbreviated shift syntax specifies multiple shift rules
              using a single pair of tags. The following table shows the
              correspondence between abbreviated syntax rules and the
              equivalent nonabbreviated rules.
     </p>
     <div class="table">
      <a name="abreviated-shift-syntax">
      </a>
      <p class="title">
       <b>
        Table 12.5 Abbreviated Shift Syntax
       </b>
      </p>
      <div class="table-contents">
       <table summary="Abbreviated and corresponding nonabbreviated shift syntax rules.">
        <colgroup>
         <col style="width: 40%"/>
         <col style="width: 60%"/>
        </colgroup>
        <thead>
         <tr>
          <th>
           Abbreviated Syntax
          </th>
          <th>
           Nonabbreviated Syntax
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <td>
           <code class="literal">
            &lt;pc&gt;xyz&lt;/pc&gt;
           </code>
          </td>
          <td>
           <code class="literal">
            &lt;p&gt;x&lt;/p&gt;&lt;p&gt;y&lt;/p&gt;&lt;p&gt;z&lt;/p&gt;
           </code>
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            &lt;sc&gt;xyz&lt;/sc&gt;
           </code>
          </td>
          <td>
           <code class="literal">
            &lt;s&gt;x&lt;/s&gt;&lt;s&gt;y&lt;/s&gt;&lt;s&gt;z&lt;/s&gt;
           </code>
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            &lt;tc&gt;xyz&lt;/tc&gt;
           </code>
          </td>
          <td>
           <code class="literal">
            &lt;t&gt;x&lt;/t&gt;&lt;t&gt;y&lt;/t&gt;&lt;t&gt;z&lt;/t&gt;
           </code>
          </td>
         </tr>
         <tr>
          <td>
           <code class="literal">
            &lt;ic&gt;xyz&lt;/ic&gt;
           </code>
          </td>
          <td>
           <code class="literal">
            &lt;i&gt;x&lt;/i&gt;&lt;i&gt;y&lt;/i&gt;&lt;i&gt;z&lt;/i&gt;
           </code>
          </td>
         </tr>
        </tbody>
       </table>
      </div>
     </div>
     <br class="table-break"/>
    </li>
    <li class="listitem">
     <p>
      An expansion is a reset rule that establishes an anchor
              point for a multiple-character sequence. MySQL supports
              expansions 2 to 6 characters long. The following rules put
      <code class="literal">
       'z'
      </code>
      greater at the primary level than
              the sequence of three characters
      <code class="literal">
       'abc'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa48702883"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>abc<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>z<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      A contraction is a shift rule that sorts a
              multiple-character sequence. MySQL supports contractions 2
              to 6 characters long. The following rules put the sequence
              of three characters
      <code class="literal">
       'xyz'
      </code>
      greater at
              the primary level than
      <code class="literal">
       'a'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa44079442"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>a<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>xyz<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Long expansions and long contractions can be used
              together. These rules put the sequence of three characters
      <code class="literal">
       'xyz'
      </code>
      greater at the primary level than
              the sequence of three characters
      <code class="literal">
       'abc'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa40078073"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>abc<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>xyz<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Normal expansion syntax uses
      <code class="literal">
       &lt;x&gt;
      </code>
      plus
      <code class="literal">
       &lt;extend&gt;
      </code>
      elements to specify
              an expansion. The following rules put the character
      <code class="literal">
       'k'
      </code>
      greater at the secondary level than
              the sequence
      <code class="literal">
       'ch'
      </code>
      . That is,
      <code class="literal">
       'k'
      </code>
      behaves as if it expands to a
              character after
      <code class="literal">
       'c'
      </code>
      followed by
      <code class="literal">
       'h'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa99695074"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>c<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>x</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>s</span><span class="token punctuation">&gt;</span></span>k<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>s</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>extend</span><span class="token punctuation">&gt;</span></span>h<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>extend</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>x</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
     <p>
      This syntax permits long sequences. These rules sort the
              sequence
      <code class="literal">
       'ccs'
      </code>
      greater at the tertiary
              level than the sequence
      <code class="literal">
       'cscs'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa46665990"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>cs<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>x</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>t</span><span class="token punctuation">&gt;</span></span>ccs<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>t</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>extend</span><span class="token punctuation">&gt;</span></span>cs<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>extend</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>x</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
     <p>
      The LDML specification describes normal expansion syntax
              as
      <span class="quote">
       “
       <span class="quote">
        tricky.
       </span>
       ”
      </span>
      See that specification for
              details.
     </p>
    </li>
    <li class="listitem">
     <p>
      Previous context syntax uses
      <code class="literal">
       &lt;x&gt;
      </code>
      plus
      <code class="literal">
       &lt;context&gt;
      </code>
      elements to
              specify that the context before a character affects how it
              sorts. The following rules put
      <code class="literal">
       '-'
      </code>
      greater at the secondary level than
      <code class="literal">
       'a'
      </code>
      , but only when
      <code class="literal">
       '-'
      </code>
      occurs after
      <code class="literal">
       'b'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa88155943"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>a<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>x</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>context</span><span class="token punctuation">&gt;</span></span>b<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>context</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>s</span><span class="token punctuation">&gt;</span></span>-<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>s</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>x</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Previous context syntax can include the
      <code class="literal">
       &lt;extend&gt;
      </code>
      element. These rules put
      <code class="literal">
       'def'
      </code>
      greater at the primary level than
      <code class="literal">
       'aghi'
      </code>
      , but only when
      <code class="literal">
       'def'
      </code>
      comes after
      <code class="literal">
       'abc'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa70885827"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>a<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>x</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>context</span><span class="token punctuation">&gt;</span></span>abc<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>context</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>def<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>extend</span><span class="token punctuation">&gt;</span></span>ghi<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>extend</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>x</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      Reset rules permit a
      <code class="literal">
       before
      </code>
      attribute.
              Normally, shift rules after a reset rule indicate
              characters that sort after the reset character. Shift
              rules after a reset rule that has the
      <code class="literal">
       before
      </code>
      attribute indicate characters
              that sort before the reset character. The following rules
              put the character
      <code class="literal">
       'b'
      </code>
      immediately
              before
      <code class="literal">
       'a'
      </code>
      at the primary level:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa9601871"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span> <span class="token attr-name">before</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span><span class="token punctuation">&gt;</span></span>a<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>b<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
     <p>
      Permissible
      <code class="literal">
       before
      </code>
      attribute values
              specify the sort level by name or the equivalent numeric
              value:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa43912994"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span> <span class="token attr-name">before</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>primary<span class="token punctuation">"</span></span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span> <span class="token attr-name">before</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>1<span class="token punctuation">"</span></span><span class="token punctuation">&gt;</span></span>

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span> <span class="token attr-name">before</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>secondary<span class="token punctuation">"</span></span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span> <span class="token attr-name">before</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>2<span class="token punctuation">"</span></span><span class="token punctuation">&gt;</span></span>

<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span> <span class="token attr-name">before</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>tertiary<span class="token punctuation">"</span></span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span> <span class="token attr-name">before</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>3<span class="token punctuation">"</span></span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
    </li>
    <li class="listitem">
     <p>
      A reset rule can name a logical reset position rather than
              a literal character:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa16695479"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>first_tertiary_ignorable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>last_tertiary_ignorable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>first_secondary_ignorable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>last_secondary_ignorable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>first_primary_ignorable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>last_primary_ignorable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>first_variable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>last_variable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>first_non_ignorable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>last_non_ignorable</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>first_trailing</span><span class="token punctuation">/&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>last_trailing</span><span class="token punctuation">/&gt;</span></span></code></pre>
     </div>
     <p>
      These rules put
      <code class="literal">
       'z'
      </code>
      greater at the
              primary level than nonignorable characters that have a
              Default Unicode Collation Element Table (DUCET) entry and
              that are not CJK:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa27369716"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>last_non_ignorable</span><span class="token punctuation">/&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>p</span><span class="token punctuation">&gt;</span></span>z<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>p</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
     <p>
      Logical positions have the code points shown in the
              following table.
     </p>
     <div class="table">
      <a name="logical-reset-position-code-points">
      </a>
      <p class="title">
       <b>
        Table 12.6 Logical Reset Position Code Points
       </b>
      </p>
      <div class="table-contents">
       <table summary="Logical positions and Unicode 4.0.0 and Unicode 5.2.0 code points.">
        <colgroup>
         <col style="width: 40%"/>
         <col style="width: 30%"/>
         <col style="width: 30%"/>
        </colgroup>
        <thead>
         <tr>
          <th scope="col">
           Logical Position
          </th>
          <th scope="col">
           Unicode 4.0.0 Code Point
          </th>
          <th scope="col">
           Unicode 5.2.0 Code Point
          </th>
         </tr>
        </thead>
        <tbody>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;first_non_ignorable/&gt;
           </code>
          </th>
          <td>
           U+02D0
          </td>
          <td>
           U+02D0
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;last_non_ignorable/&gt;
           </code>
          </th>
          <td>
           U+A48C
          </td>
          <td>
           U+1342E
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;first_primary_ignorable/&gt;
           </code>
          </th>
          <td>
           U+0332
          </td>
          <td>
           U+0332
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;last_primary_ignorable/&gt;
           </code>
          </th>
          <td>
           U+20EA
          </td>
          <td>
           U+101FD
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;first_secondary_ignorable/&gt;
           </code>
          </th>
          <td>
           U+0000
          </td>
          <td>
           U+0000
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;last_secondary_ignorable/&gt;
           </code>
          </th>
          <td>
           U+FE73
          </td>
          <td>
           U+FE73
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;first_tertiary_ignorable/&gt;
           </code>
          </th>
          <td>
           U+0000
          </td>
          <td>
           U+0000
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;last_tertiary_ignorable/&gt;
           </code>
          </th>
          <td>
           U+FE73
          </td>
          <td>
           U+FE73
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;first_trailing/&gt;
           </code>
          </th>
          <td>
           U+0000
          </td>
          <td>
           U+0000
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;last_trailing/&gt;
           </code>
          </th>
          <td>
           U+0000
          </td>
          <td>
           U+0000
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;first_variable/&gt;
           </code>
          </th>
          <td>
           U+0009
          </td>
          <td>
           U+0009
          </td>
         </tr>
         <tr>
          <th scope="row">
           <code class="literal">
            &lt;last_variable/&gt;
           </code>
          </th>
          <td>
           U+2183
          </td>
          <td>
           U+1D371
          </td>
         </tr>
        </tbody>
       </table>
      </div>
      <div class="table-contents">
       <table cellpadding="0" cellspacing="0" style="position: fixed; top: 0px; display: none; left: 431px; width: 607px;">
        <thead>
         <tr>
          <th scope="col" style="width: 242.281px;">
           Logical Position
          </th>
          <th scope="col" style="width: 181.703px;">
           Unicode 4.0.0 Code Point
          </th>
          <th scope="col" style="width: 181.734px;">
           Unicode 5.2.0 Code Point
          </th>
         </tr>
        </thead>
       </table>
      </div>
     </div>
     <br class="table-break"/>
    </li>
    <li class="listitem">
     <p>
      The
      <code class="literal">
       &lt;collation&gt;
      </code>
      element permits a
      <code class="literal">
       shift-after-method
      </code>
      attribute that
              affects character weight calculation for shift rules. The
              attribute has these permitted values:
     </p>
     <div class="itemizedlist">
      <ul class="itemizedlist" style="list-style-type: circle; ">
       <li class="listitem">
        <p>
         <code class="literal">
          simple
         </code>
         : Calculate character weights
                  as for reset rules that do not have a
         <code class="literal">
          before
         </code>
         attribute. This is the
                  default if the attribute is not given.
        </p>
       </li>
       <li class="listitem">
        <p>
         <code class="literal">
          expand
         </code>
         : Use expansions for shifts
                  after reset rules.
        </p>
       </li>
      </ul>
     </div>
     <p>
      Suppose that
      <code class="literal">
       '0'
      </code>
      and
      <code class="literal">
       '1'
      </code>
      have weights of
      <code class="literal">
       0E29
      </code>
      and
      <code class="literal">
       0E2A
      </code>
      and we
              want to put all basic Latin letters between
      <code class="literal">
       '0'
      </code>
      and
      <code class="literal">
       '1'
      </code>
      :
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa85076258"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>reset</span><span class="token punctuation">&gt;</span></span>0<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>reset</span><span class="token punctuation">&gt;</span></span>
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>pc</span><span class="token punctuation">&gt;</span></span>abcdefghijklmnopqrstuvwxyz<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>pc</span><span class="token punctuation">&gt;</span></span></code></pre>
     </div>
     <p>
      For simple shift mode, weights are calculated as follows:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-none"><div class="docs-select-all right" id="sa11454493"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">'a' has weight 0E29+1
'b' has weight 0E29+2
'c' has weight 0E29+3
...</code></pre>
     </div>
     <p>
      However, there are not enough vacant positions to put 26
              characters between
      <code class="literal">
       '0'
      </code>
      and
      <code class="literal">
       '1'
      </code>
      . The result is that digits and
              letters are intermixed.
     </p>
     <p>
      To solve this, use
      <code class="literal">
       shift-after-method="expand"
      </code>
      . Then
              weights are calculated like this:
     </p>
     <div class="copytoclipboard-wrapper">
      <pre class="programlisting language-none"><div class="docs-select-all right" id="sa29372544"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-none">'a' has weight [0E29][233D+1]
'b' has weight [0E29][233D+2]
'c' has weight [0E29][233D+3]
...</code></pre>
     </div>
     <p>
      <code class="literal">
       233D
      </code>
      is the UCA 4.0.0 weight for
              character
      <code class="literal">
       0xA48C
      </code>
      , which is the last
              nonignorable character (a sort of the greatest character
              in the collation, excluding CJK). UCA 5.2.0 is similar but
              uses
      <code class="literal">
       3ACA
      </code>
      , for character
      <code class="literal">
       0x1342E
      </code>
      .
     </p>
    </li>
   </ul>
  </div>
  <p>
   <span class="bold">
    <strong>
     MySQL-Specific LDML
          Extensions
    </strong>
   </span>
  </p>
  <p>
   An extension to LDML rules permits the
   <code class="literal">
    &lt;collation&gt;
   </code>
   element to include an
          optional
   <code class="literal">
    version
   </code>
   attribute in
   <code class="literal">
    &lt;collation&gt;
   </code>
   tags to indicate the UCA
          version on which the collation is based. If the
   <code class="literal">
    version
   </code>
   attribute is omitted, its default
          value is
   <code class="literal">
    4.0.0
   </code>
   . For example, this
          specification indicates a collation that is based on UCA
          5.2.0:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-xml"><div class="docs-select-all right" id="sa77918906"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-xml"><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>collation</span> <span class="token attr-name">id</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span><em class="replaceable">nnn</em><span class="token punctuation">"</span></span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>utf8mb4_<em class="replaceable">xxx</em>_ci<span class="token punctuation">"</span></span> <span class="token attr-name">version</span><span class="token attr-value"><span class="token punctuation">=</span><span class="token punctuation">"</span>5.2.0<span class="token punctuation">"</span></span><span class="token punctuation">&gt;</span></span>
...
<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>collation</span><span class="token punctuation">&gt;</span></span></code></pre>
  </div>
 </div>
 <br/>
</div>
