eMisc
asked on
how to avoid latin characters discrimination on SQLITE query?
I need to avoid latin characters discrimination on SQLITE query results
if I search %a% it only returns results containing 'a' but not 'á' and I need to get all results avoiding any discrimination
if it helps, the query is coded on javascript
thank you
if I search %a% it only returns results containing 'a' but not 'á' and I need to get all results avoiding any discrimination
if it helps, the query is coded on javascript
thank you
You'll have to just put them all in using or conditions. There is nothing that ties them all together.
Actually you can shorten it like this %[âáä]% but you need all of them.
The [ ] tells it to find any single character in the list. I'm not sure if upper() works on special characters like that. My gut says no, so you would need %[ÀÁÂÃÄÅàáâãäå]%
ASKER
in fact %a% was only an example, if I search for 'hello' I need to get all registries: hello, héllo or helló
Then you'll need 'h[eèéêë]ll[oòóôõ]'
ASKER
I just tested it and it doesn't work
Are you using LIKE? SQLite's LIKE doesn't support [] use GLOB it uses the Unix syntax and supports them.
If you get stuck post your query so I have a better idea of what is going on.
ASKER
I was using LIKE, can you post some example of GLOB please? my skills about sql/lite are basics
thank you
thank you
The syntax is the same as LIKE it just behaves differently. I assume you can just change the word LIKE to GLOB in your query but without seeing it can't be sure. Oh, GLOB is not case sensitive so use lower() or something.
ASKER
yes, I just replaced the word but it doesn't return any results:
SELECT * FROM sonidos where name glob '%h[eèé]ll[oòó]%'
SELECT * FROM sonidos where name glob '%h[eèé]ll[oòó]%'
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
The * means any characters or no characters and the [ ] mean any character in the set.
ASKER
thank you!