0

I have a procedure that searches through the database and returns the results based on the condition passed as an argument. For instance;

CALL myProcs('Björn'); 

This query will return all users that has 'björn' in their names. However, I'd like to retrieve the same results when the parameter is passed as 'bjorn' (notice the 'ö' and 'o'). If it was only one character then there would be no problem but I'd like to achieve the same thing for :

i => ı, ö => o, ü => u, ë => e etc etc...

What is the easiest approach to achieve this goal? I am using php 5+ and Mysql.

3 Answers 3

2

You could set a specific collation for your database tables (http://dev.mysql.com/doc/refman/5.0/en/charset-unicode-sets.html) which would allow for correct comparison between ignorable characters. For ex:

Ä = A ; Ö = O ; Ü = U

utf8_general_ci and utf8_unicode_ci both have the desired effect.

Cheers

Sign up to request clarification or add additional context in comments.

Comments

2

Take a look to this url:

I think this is the better way unless you want to use an array for the replacement.

Comments

2

Basically, while you are reading the parameter values. Use them as "UTF-8" Format.

Refer Tips for Supporting UTF-8 in Your PHP5 Applications

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.