I'm trying to have a function which takes a string and returns the same string without any accented letters. Instead, the accented letters should return the same letter without the accent. This function is not working:
function StripAccents(str)
accent = "ÈÉÊËÛÙÏÎÀÂÔÖÇèéêëûùïîàâôöç"
noaccent = "EEEEUUIIAAOOCeeeeuuiiaaooc"
currentChar = ""
result = ""
k = 0
o = 0
FOR k = 1 TO len(str)
currentChar = mid(str,k, 1)
o = InStr(accent, currentChar)
IF o > 0 THEN
result = result & mid(noaccent,k,1)
ELSE
result = result & currentChar
END IF
NEXT
StripAccents = result
End function
testStr = "Test : à é À É ç"
response.write(StripAccents(testStr))
This is the result using the above:
Test : E E Eu EE E