title: Why isn't locale.strxfrm("Gè") a prefix of locale.strxfrm("Gène")) with locale "fr_FR.UTF-8"?
body: <p>The code here is in Python, but the behavior should be the same in C/C++ using <em>locale</em>.</p>
  
  <pre><code>&gt;&gt;&gt; import locale
  &gt;&gt;&gt; locale.setlocale(locale.LC_ALL, "fr_FR.UTF-8")
  &gt;&gt;&gt; locale.strxfrm("Gène").startswith(locale.strxfrm("Gè"))
  False
  </code></pre>
  
  <p>I know it is not supposed to be used that way, but I'm wondering what is going on...</p>
  
  <p><strong>Context:</strong> <br>
  I have an array of strxfrm-transformed strings and an normal input text. I want to know which strxfrm-transformed strings started with text <em>before</em> transformation. Is it doable at all ? How ?</p>
  
  <p><strong>Bonus Question:</strong></p>
  
  <p>Can we get the per-locale list of equivalent letters ? Can we check for equivalent strings ?</p>
  
  <p>What I mean is:<br> 
  In <strong><code>"de_DE.UTF8"</code></strong>, can I get something like </p>
  
  <pre><code>locale.strxfrm("Wissen").startswith(locale.strxfrm("Wiß")) 
  </code></pre>
  
  <p>returning True ?</p>
  
  <p>Since <code>"ß" and "ss" are equivalent</code> in sorting (unless it's the only difference):</p>
  
  <pre><code>&gt; locale.strxfrm("Wiessen") &lt; locale.strxfrm("Wießen") &lt; locale.strxfrm("Wiessen0")
  True
  </code></pre>
  
  <p>Same for "œ" and "oe" in French.</p>
  
  <p><strong>EDIT</strong>: Regarding the bonus, I saw <a href="https://stackoverflow.com/questions/19830643/python-locale-aware-string-comparison?rq=1">Python locale-aware string comparison</a> but the answer relies on 3rd party libs, so I proposed a workaround hacked function :</p>
  
  <pre><code>def isEquivalent(str1, str2):
      return ( locale.strxfrm(str2[:-1]) &lt; locale.strxfrm(str1) &lt;= locale.strxfrm(str2) &lt; locale.strxfrm(str1+"0") 
      or 
      locale.strxfrm(str1[:-1]) &lt; locale.strxfrm(str2) &lt;= locale.strxfrm(str1) &lt; locale.strxfrm(str2+"0") )
  </code></pre>