"yearTiger2 002" <ha*****@yahoo. com> wrote in message
news:66******** *************** **@posting.goog le.com...
Our company's back end database server does not handle french
accentuated characters well. We need to replace those characters with
english letters when validating the form inputs. Any suggestions? I've
never delt with foreign languages before...any help greatly
apprieciated!
It's a matter of scanning for accented character codes and replacing them
accordingly. This would be my solution, which will remove grave, acute and
circumflex accents from vowels.
<HTML>
<HEAD>
<title>Accent Stripper</title>
<STYLE>
body{font-size:1.2em}
</STYLE>
</HEAD>
<BODY bgcolor="#0000f f" text="#ffffff" link="#00ffff" vlink="#00ffff" >
<FORM>
<TEXTAREA cols=30 rows=3 onblur='this.va lue=stripVowelA ccent(this.valu e)' wrap>
À Á Â à á â È É Ê è é ê
Ì Í Î ì í î Ò Ó Ô ò ó ô
Ù Ú Û ù ú û
</TEXTAREA>
</FORM>
<BR>
To strip accents, click on link or blur the text field.<BR><BR>
<A HREF='#'
onclick='docume nt.forms[0].elements[0].value=stripVow elAccent(docume nt.forms[0].
elements[0].value);return false'>Strip Accents</A>
<SCRIPT type='text/javascript'>
/* (C)Stephen Chalmers
* Strips grave, acute & circumflex accents from vowels
*/
function stripVowelAccen t(str)
{
var s=str;
var rExps=[ /[\xC0-\xC2]/g, /[\xE0-\xE2]/g,
/[\xC8-\xCA]/g, /[\xE8-\xEB]/g,
/[\xCC-\xCE]/g, /[\xEC-\xEE]/g,
/[\xD2-\xD4]/g, /[\xF2-\xF4]/g,
/[\xD9-\xDB]/g, /[\xF9-\xFB]/g ];
var repChar=['A','a','E','e' ,'I','i','O','o ','U','u'];
for(var i=0; i<rExps.length ; i++)
s=s.replace(rEx ps[i],repChar[i]);
return s;
}
</SCRIPT>
</BODY>
</HTML>
--
Stephen Chalmers