Click to See Complete Forum and Search --> : How to convert "é" to "e", "à" to "a" ...


turb
10-13-2004, 04:58 PM
I try to change all french character from a string for searching thru a db... any idea?

turb

stevem2004
10-14-2004, 10:44 AM
Could you not identify the characters by keycode, before they are entered into the database?
I use a onKeyPress event to stop users typing certain keys, could you not use a similar script?

Sorry I don't know what the keycodes for your characters are, but I was thinking something like a if then statement.

Below is part of the code I use, maybe it will help.


onKeypress="if(!isNS4){if ((event.keyCode > 32 && event.keyCode < 39)


Steve

javaNoobie
10-14-2004, 09:26 PM
Not sure if this is possible. Store all the french characters and their replacement characters in a db. When you retrieve a string, loop through the db and replace accordingly. Probably like this:

Dim rs
set rs = Server.CreateObject("ADODB.Recordset")

rs.ActiveConnection = conn
rs.Source = "SELECT frenchChar, replaceChar FROM tbl"
rs.CursorType = 0
rs.Open

while not rs.eof
str1 = Replace(str1, rs("frenchChar"), rs("replaceChar"))
rs.movenext
wend