<p dir="auto">Since <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ScottPJones/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/ScottPJones">@ScottPJones</a> was mentioning upper/lowercase functions recently, I took a quick look at them and I noticed that we are calling <code class="notranslate">towupper</code> and <code class="notranslate">towlower</code>, which are C99 functions that accept <code class="notranslate">wchar_t</code> arguments.</p>
<p dir="auto">Unfortunately, this means that they are broken on Windows (where <code class="notranslate">wchar_t</code> is 16 bits) for any character outside the BMP.   Even on other platforms with a 32-bit <code class="notranslate">wchar_t</code>, they are going to return different results on different systems, and many systems will have out-of-date Unicode tables.  They are also locale-dependent; I'm not sure if this is desirable for us.</p>
<p dir="auto">utf8proc has up-to-date upper/lower/titlecase mapping data already in its "database" (generated from <a href="http://www.unicode.org/Public/UNIDATA/UnicodeData.txt" rel="nofollow">http://www.unicode.org/Public/UNIDATA/UnicodeData.txt</a>), so maybe we should just add a <code class="notranslate">utf8proc_toupper</code> function (etc.) to utf8proc to make this accessible.  Then we could call that (probably plus a check for the common case of ASCII codepoints).</p>
<ol dir="auto">
<li>
<p dir="auto">End-of-word contexts. As reported in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="39527706" data-permission-text="Title is private" data-url="https://github.com/JuliaLang/julia/issues/7847" data-hovercard-type="issue" data-hovercard-url="/JuliaLang/julia/issues/7847/hovercard" href="https://github.com/JuliaLang/julia/issues/7847">#7847</a>, for example, capital sigma Σ should map to lowercase terminal sigma ς at the end of a word, not ordinary sigma σ:</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="julia&gt; lowercase(&quot;ΛΌΓΟΣ&quot;) #logos; λόγος
&quot;λόγοσ&quot;"><pre class="notranslate">julia<span class="pl-k">&gt;</span> <span class="pl-c1">lowercase</span>(<span class="pl-s"><span class="pl-pds">"</span>ΛΌΓΟΣ<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">#</span>logos; λόγος</span>
<span class="pl-s"><span class="pl-pds">"</span>λόγοσ<span class="pl-pds">"</span></span></pre></div>
</li>
<li>
<p dir="auto">Locale-specific contexts: let's not <a href="http://www.theinquirer.net/inquirer/news/1017243/cellphone-localisation-glitch" rel="nofollow">get anyone accidentally killed thanks to incorrect localization</a>.</p>
<div class="highlight highlight-source-julia notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$LANG=&quot;tr_TR&quot; julia
...
julia&gt; uppercase(&quot;sikisinca&quot;) #SİKİSİNCA
&quot;SIKISINCA&quot;"><pre class="notranslate"><span class="pl-k">$</span>LANG<span class="pl-k">=</span><span class="pl-s"><span class="pl-pds">"</span>tr_TR<span class="pl-pds">"</span></span> julia
<span class="pl-k">...</span>
julia<span class="pl-k">&gt;</span> <span class="pl-c1">uppercase</span>(<span class="pl-s"><span class="pl-pds">"</span>sikisinca<span class="pl-pds">"</span></span>) <span class="pl-c"><span class="pl-c">#</span>SİKİSİNCA</span>
<span class="pl-s"><span class="pl-pds">"</span>SIKISINCA<span class="pl-pds">"</span></span></pre></div>
</li>
</ol>