Link to home
Start Free TrialLog in
Avatar of cpk68
cpk68

asked on

Searching for accented characters

Hello all,

I have a search form where users can search by clients' first and last names. As quite a lot of the clients are foreign, I need to automatically search for accented characters as well. ie if the user enters Fred for first name and Surname for surname the results sould show eg.

Fred Surname
Frèd Sûrnamë
Frêd Súrname
etc.

for all the diffirent possible accented characters. All I can think of is to check the search string for a character that could have an accented character and then repeating the search for all possible combinations, but this seems very cumbersome and slow. Does anyone know of an easy way to do this?
Avatar of cpk68
cpk68

ASKER

I see that in posting the question, the accented characters have been changed. The names should all be "Fred Surname", but with accented characters, which is what I want to search for, Not as they appear above.
I'm not sure I understand the question entirely, but perhaps you could search the names without the accented characters and then only check for the accents in that result set, which would presumably be smaller.

Does the search treat a e with an accent the same as it does an e without an accent?

*
ASKER CERTIFIED SOLUTION
Avatar of dmang
dmang
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of cpk68

ASKER

Thanks for your replies.

Slingblade: ideally I'd like to have the search treat an "e" with or without an accent the same. i.e. searching for "Fred" will bring up all the "Fred"s irrespective of whether there is an accent on the "e" or not. I don't want the user to have to type an accented character for the search to find accented characters.

dmang: I see what your getting at, but replacing the "e" in "Fred" with a wildcard will cause the search results not to be entirely accurate either. When searching for "Fred" the results could contain names like:

"Frud", Frxd" etc.

which I'd like to avoid.

The only other solution I can think of is removing the accented characters when the user enters the name and saving 2 firstnames and 2 last names for each client. Then using the one without accents for searching and the one with accents for displaying. I'd prefer not to do that though.

Any other suggestions?
When you are searching proper names, you're only going ot get back so much..

Put the results in a list, and present them to the user to make the final decision...

Even without accented characters, you're likely to return multiple instances (i.e. John Smith)
cpk68:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.