• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 350
  • Last Modified:

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?
0
cpk68
Asked:
cpk68
1 Solution
 
cpk68Author Commented:
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.
0
 
SlingBladeCommented:
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?

*
0
 
dmangCommented:
Here's a thought ..

Try replacing all the potentially accented characters in the name with a "wild card" character, and then use the result for your lookup using "LIKE".

This is from a simple form with two text boxes, and a commandbutton.
Enter the name in textbox1, click the command, and the search string will show in textbox2.

(* for DAO, % for adodb)


Private Sub Command1_Click()

    Dim c As Integer
    Dim t As String
    Dim l As Integer
   
    c = 1
   
    For c = 1 To Len(txt1.Text)
       
        t = Mid$(txt1.Text, c, 1)
         
       
        Select Case t
       
            Case "A", "a", "E", "e", "I", "i", "O", "o", "U", "u", "C", "c", "N", "n", "Y", "y"
               
                t = "*"
               
        End Select
       
        txt2.Text = txt2.Text & t
           
    Next c
   

End Sub
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
cpk68Author Commented:
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?
0
 
dmangCommented:
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)
0
 
CleanupPingCommented:
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.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now