Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to MySQL work "case insensitive" and "accent insensitive" in UTF-8
    primarykey
    data
    text
    <p>I have a schema in "utf8 -- UTF-8 Unicode" as charset and a collation of "utf8_spanish_ci".</p> <p>All the inside tables are InnoDB with same charset and collation as mentioned.</p> <p>Here comes the problem:</p> <p>with a query like</p> <pre><code>SELECT * FROM people p WHERE p.NAME LIKE '%jose%'; </code></pre> <p>I get 83 result rows. I should have 84 results, because I know it.</p> <p>Changing where for:</p> <pre><code>WHERE p.NAME LIKE '%JOSE%'; </code></pre> <p>I get the exact same 83 rows. With combinations like JoSe, Jose, JOSe, etc. All the same 83 rows are reported.</p> <p>The problem comes when accents play in game. If do:</p> <pre><code>WHERE p.NAME LIKE '%josé%'; </code></pre> <p>I get no results. 0 rows.</p> <p>But if I do:</p> <pre><code>WHERE p.NAME LIKE '%JOSÉ%'; </code></pre> <p>I get just one resulting row, so 1 row. This is the only row wich hace accented "jose" and capitalized.</p> <p>I've tried with josÉ, or JoSÉ or whatever combination I do, as long as the accented letter stays capitalized or not, as it really is stored in the database and it stills returning the only row. If I suddenly change "É" for "é" in whatever combination I do with the capitalization in JOSE, it returns no rows.</p> <p>So conclusions:</p> <ul> <li>Case insensitive if no latin characters plays in game.</li> <li>Case sensitive if latin characters appears.</li> <li>Accent sensitive, as if I search JOSE or jose, I only get 83 rows, instead of the 84 rows I need.</li> </ul> <p>What I want?</p> <ul> <li>To search "jose", "JOSE", "José", "JOSÉ", "JÒSE", "jöse", "JoSÈ", ... have to return the 84 rows I know that exists. I what to turn my searchs to case insensitive and "latin" insensitive.</li> </ul> <p>Solutions like <code>COLLATION</code> on <code>LIKE</code> doesn't work for me, don't know why...</p> <p>What can I do?</p> <p>Thanks in advance!</p> <p><strong>EDIT:</strong></p> <p>If I do sometingh like:</p> <pre><code>WHERE p.NAME LIKE '%jose%' COLLATE utf8_general_ci; </code></pre> <p>I get the error:</p> <pre>COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'</pre> <p>And I've changed all the possible collations on the columns too!</p> <p>And if I do something like:</p> <pre><code>WHERE p.NAME LIKE _utf8 '%jose%' COLLATE utf8_general_ci; </code></pre> <p>The same 83 rows are reported, as if I've made nothing...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload