I want to search user input in my database. database collation is latin1_swedish_ci
. I don't want to change that, instead can I change user input utf-8
to latin1_swedish_ci
?
Edit:
I approach two methods.
Method 1: I imported and used default collation latin1_swedish_ci
and character set latin1
. Then I have
Here I can query like SELECT * FROM dict WHERE english_word = '$_value'
and I get all the values of column including malayalam_definition in the browser as desired. But problem is I can't query like SELECT * FROM dict WHERE malayalam_definition = '$_value'
. It returns no result.
Method 2: I changed collation to utf8_unicode_ci
and character set to utf8
. Then in mysql I get desired values like
Here I when I query like SELECT * FROM dict WHERE english_word = '$_value'
in browser I get question marks in malayalam_definition
values like
Result of SHOW VARIABLES LIKE 'character\_set\_%';
+--------------------------+--------+
| Variable_name | Value |
+--------------------------+--------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
+--------------------------+--------+
7 rows in set (0.00 sec)
Do I need to change character_set_server
, then how to do it?