<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [INTL] Implement Collator Compare Functions"
   href="https://bugs.webkit.org/show_bug.cgi?id=147604#c28">Comment # 28</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - [INTL] Implement Collator Compare Functions"
   href="https://bugs.webkit.org/show_bug.cgi?id=147604">bug 147604</a>
              from <span class="vcard"><a class="email" href="mailto:sukolsak&#64;gmail.com" title="Sukolsak Sakshuwong &lt;sukolsak&#64;gmail.com&gt;"> <span class="fn">Sukolsak Sakshuwong</span></a>
</span></b>
        <pre>Three new changes:

1. Include &lt;unicode/uiter.h&gt; in Collator.h to fix the build issue on Windows.

I tried using WTF_EXPORT_PRIVATE on UCharIterator createIterator(StringView) in Collator.h but I got the same error message, except that there was &quot;__declspec(dllimport)&quot; at the beginning of the declaration (<a href="https://webkit-queues.webkit.org/results/567993">https://webkit-queues.webkit.org/results/567993</a>). It looks like we need to include the definition of UCharIterator.

2. Only check for U_FAILURE(status) after the last ucol_setAttribute.

ucol_setAttribute returns immediately if U_FAILURE(status) is true. (See the source code at <a href="http://source.icu-project.org/repos/icu/icu/trunk/source/i18n/ucol.cpp">http://source.icu-project.org/repos/icu/icu/trunk/source/i18n/ucol.cpp</a>) So, there's no harm in calling ucol_setAttribute consecutively. The ICU coding guidelines also state that &quot;It is not necessary to check for U_FAILURE() immediately before calling a function that takes a UErrorCode parameter, because that function is supposed to check for failure.&quot; (<a href="http://userguide.icu-project.org/dev/codingguidelines">http://userguide.icu-project.org/dev/codingguidelines</a>)

It's super unlikely that ucol_setAttribute will ever throw an error. From the source code, ucol_setAttribute is just setting flags. The only error that it will ever throw is U_ILLEGAL_ARGUMENT_ERROR. (<a href="http://source.icu-project.org/repos/icu/icu/trunk/source/i18n/collationsettings.cpp">http://source.icu-project.org/repos/icu/icu/trunk/source/i18n/collationsettings.cpp</a>) But I still do a run-time check instead of ASSERT just in case.

3. Use jsNontrivialString to create strings for usage and sensitivity.

It's obvious from the source code that these strings are longer than one character.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>