I am using jQuery Autocomplete plugin 1.1 for a project.
Here is my calling code:
$("#txtCombo").autocomplete("http://www.example.com/autocomplete.php", {
autoFill: false,
width: 550,
minChars: 3,
selectFirst: false
});
The problem is that what ever I type in the autocomplete, it gets converted to lower case when it reaches the php file autocomplete.php
For e.g. if I search for "Smart Boy", the php file will receive "smart boy". This is good in a way because when I make a like search in the database for the query, I get all the matching results irrespective of the letter case.
But here is the problem, when I run this script for greek characters, for e.g. when I enter query "Μικρές Οικιακές Συσκευές", it is converted to "μικρές οικιακές συσκευές". Now when I use a like query as below:
"SELECT ID, NAME FROM CATEGORIES WHERE NAME LIKE '%".$query."%'"
I get nothing, because the database does not check for greek letters with case-insensitive search.
I tried using collation keyword like this:
"SELECT ID, NAME FROM CATEGORIES WHERE NAME LIKE '%".$query."%' COLLATE utf8_general_ci"
But I get this error: COLLATION 'utf8_general_ci' is not valid for CHARACTER SET 'latin1'
I understand that the charset of the tables is latin1 so it wont work with utf8 collation, so if I try using latin1_general_ci collation, it gives me this error:
Illegal mix of collations (utf8_general_ci,IMPLICIT) and (latin1_general_ci,EXPLICIT) for operation 'like'
Only if I can stop autocomplete by converting the query to lowercase, it would solve the problem pretty much.
Why is the plugin converting to lowercase anyway when I have not specified any such thing in the parameters to call?
Any ideas....